headers: surround GCC attribute names with double underscores
authorJonathan Nieder <jrnieder@gmail.com>
Sat, 14 Apr 2012 13:06:57 +0000 (15:06 +0200)
committerYang Tse <yangsita@gmail.com>
Sat, 14 Apr 2012 13:06:57 +0000 (15:06 +0200)
This protects from attribute names being defined by third party's code.

Improvement: http://curl.haxx.se/mail/lib-2012-04/0127.html

include/curl/typecheck-gcc.h
lib/setup.h
m4/curl-compilers.m4

index 5c584b0..f8917e8 100644 (file)
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -141,8 +141,9 @@ __extension__ ({                                                              \
 
 /* To define a new warning, use _CURL_WARNING(identifier, "message") */
 #define _CURL_WARNING(id, message)                                            \
-  static void __attribute__((warning(message))) __attribute__((unused))       \
-  __attribute__((noinline)) id(void) { __asm__(""); }
+  static void __attribute__((__warning__(message)))                           \
+  __attribute__((__unused__)) __attribute__((__noinline__))                   \
+  id(void) { __asm__(""); }
 
 _CURL_WARNING(_curl_easy_setopt_err_long,
   "curl_easy_setopt expects a long argument for this option")
index 6ce93db..4bce5a9 100644 (file)
@@ -611,7 +611,7 @@ int netware_init(void);
 #ifndef __GNUC__
 #define UNUSED_PARAM /*NOTHING*/
 #else
-#define UNUSED_PARAM __attribute__((unused))
+#define UNUSED_PARAM __attribute__((__unused__))
 #endif
 
 /*
index 9b212e4..fffe85f 100644 (file)
@@ -21,7 +21,7 @@
 #***************************************************************************
 
 # File version for 'aclocal' use. Keep it a single number.
-# serial 59
+# serial 60
 
 
 dnl CURL_CHECK_COMPILER
@@ -1393,7 +1393,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_SYMBOL_HIDING], [
   case "$compiler_id" in
     CLANG)
       dnl All versions of clang support -fvisibility=
-      tmp_EXTERN="__attribute__ ((visibility (\"default\")))"
+      tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
       tmp_CFLAGS="-fvisibility=hidden"
       supports_symbol_hiding="yes"
       ;;
@@ -1401,7 +1401,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_SYMBOL_HIDING], [
       dnl Only gcc 3.4 or later
       if test "$compiler_num" -ge "304"; then
         if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
-          tmp_EXTERN="__attribute__ ((visibility (\"default\")))"
+          tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
           tmp_CFLAGS="-fvisibility=hidden"
           supports_symbol_hiding="yes"
         fi
@@ -1420,7 +1420,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_SYMBOL_HIDING], [
               printf("icc fvisibility bug test");
             ]])
           ],[
-            tmp_EXTERN="__attribute__ ((visibility (\"default\")))"
+            tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
             tmp_CFLAGS="-fvisibility=hidden"
             supports_symbol_hiding="yes"
           ])