bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

glr.cc: disable warnings from Clang on macOS


From: Akim Demaille
Subject: glr.cc: disable warnings from Clang on macOS
Date: Sun, 8 Dec 2019 17:01:14 +0100

Hi Paul,

You might want to have a quick look at this one, in case you'd think I'm not 
strict enough on the conditions to install this pragma.  Cheers!

commit b3abe014f24b26538464f0e5aabfa9b1e94fcd60
Author: Akim Demaille <address@hidden>
Date:   Sun Dec 8 16:34:53 2019 +0100

    glr.cc: disable warnings from Clang on macOS
    
        $ cat test.cc
        #include <stddef.h>
        #include <stdint.h>
    
        ptrdiff_t half_max_capacity = PTRDIFF_MAX;
        $ clang++-mp-9.0 -pedantic -std=c++98 /tmp/test.cc -c
        /tmp/test.cc:4:31: warning: 'long long' is a C++11 extension 
[-Wc++11-long-long]
        ptrdiff_t half_max_capacity = PTRDIFF_MAX;
                                      ^
        
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdint.h:149:23:
                note: expanded from macro 'PTRDIFF_MAX'
        #define PTRDIFF_MAX       INT64_MAX
                                  ^
        
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdint.h:75:26:
                note: expanded from macro 'INT64_MAX'
        #define INT64_MAX        9223372036854775807LL
                                 ^
        1 warning generated.
    
    * data/skeletons/glr.cc: here.

diff --git a/data/skeletons/glr.cc b/data/skeletons/glr.cc
index ceb825a9..343b52ef 100644
--- a/data/skeletons/glr.cc
+++ b/data/skeletons/glr.cc
@@ -265,6 +265,12 @@ b4_percent_code_get([[requires]])[
 # pragma GCC diagnostic ignored "-Wold-style-cast"
 #endif
 
+// On MacOS, PTRDIFF_MAX is defined as long long, which Clang's
+// -pedantic reports as being a C++11 extension.
+#if defined __APPLE__ && YY_CPLUSPLUS < 201103L && 4 <= __clang_major__
+# pragma clang diagnostic ignored "-Wc++11-long-long"
+#endif
+
 // Whether we are compiled with exception support.
 #ifndef YY_EXCEPTIONS
 # if defined __GNUC__ && !defined __EXCEPTIONS




reply via email to

[Prev in Thread] Current Thread [Next in Thread]