https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124305

            Bug ID: 124305
           Summary: btf_decl_tag and btf_type_tag attributes give compiler
                    errors in C++
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: btf-debug, documentation
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sandra at gcc dot gnu.org
  Target Milestone: ---

This test case is the examples of the btf_decl_tag and btf_type_tag in the GCC
manual:

int *foo1 __attribute__ ((btf_decl_tag ("__percpu")));
int * __attribute__ ((btf_type_tag ("__user"))) bar1;

int *foo2 [[gnu::btf_decl_tag ("__percpu")]];
int * [[gnu::btf_type_tag ("__user")]] bar2;

It compiles without error in c, but with g++ the output it gives

ex.c:1:53: error: unsupported wide string type argument in 'btf_decl_tag'
attribute 
    1 | int *foo1 __attribute__ ((btf_decl_tag ("__percpu")));
      |                                                     ^
ex.c:2:49: error: unsupported wide string type argument in 'btf_type_tag'
attribute 
    2 | int * __attribute__ ((btf_type_tag ("__user"))) bar1;
      |                                                 ^~~~
ex.c:4:44: error: unsupported wide string type argument in 'btf_decl_tag'
attribute 
    4 | int *foo2 [[gnu::btf_decl_tag ("__percpu")]];
      |                                            ^
ex.c:5:40: error: unsupported wide string type argument in 'btf_type_tag'
attribute 
    5 | int * [[gnu::btf_type_tag ("__user")]] bar2;
      |                                        ^~~~

Compiled with arm-none-eabi-[gcc,g++] -S ex.c -gbtf
I tried adding -finput-charset=UTF-8 but that didn't help.  

If this is intentionally broken in C++ the manual ought to say that it's C
only.

Reply via email to