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

            Bug ID: 114007
           Summary: gcc chokes on
                    __has_cpp_attribute(clang::unsafe_buffer_usage)
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ro at gcc dot gnu.org
                CC: iains at gcc dot gnu.org
  Target Milestone: ---

In Xcode 15.3 beta 3, <sys/cdefs.h> gained the equivalent of the following:

$ cat cd2.c
#ifndef __has_cpp_attribute
#define __has_cpp_attribute(x) 0
#endif

#if __has_cpp_attribute(clang::unsafe_buffer_usage) 
#define __has_safe_buffers 1
#endif

Unfortunately, this breaks quite a number of testcases with -std below c23:

$ gcc -std=c11 -c cd2.c
cd2.c:5:30: error: missing ')' after "__has_attribute"
    5 | #if __has_cpp_attribute(clang::unsafe_buffer_usage)
      |                              ^
cd2.c:5:31: error:  ':' without preceding '?'
    5 | #if __has_cpp_attribute(clang::unsafe_buffer_usage)
      |                               ^

while g++ always accepts it.  However, current clang/clang++ main always
accepts
it.

Reply via email to