From c8726244aeb5e65775e5d6038aa4d7aacfbb3378 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicolas=20L=C3=A9veill=C3=A9?= <nicolas@uucidl.com>
Date: Sun, 9 Aug 2015 18:37:07 +0200
Subject: [PATCH] Wrap remaining __attribute__

We wrap all remaining references to __attribute__ into a macro call to
H_GCC_ATTRIBUTE, to allow compilation with MSVC CL.EXE
---
 src/backends/contextfree.h              | 2 +-
 src/bindings/cpp/hammer/hammer_test.hpp | 2 +-
 src/bindings/desugar-header.pl          | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/backends/contextfree.h b/src/backends/contextfree.h
index 9105636f..29b51a08 100644
--- a/src/backends/contextfree.h
+++ b/src/backends/contextfree.h
@@ -22,7 +22,7 @@ struct HCFStack_ {
 };
 
 #ifndef UNUSED
-#define UNUSED __attribute__((unused))
+#define UNUSED H_GCC_ATTRIBUTE((unused))
 #endif
 
 static inline HCFChoice* h_cfstack_new_choice_raw(HAllocator *mm__, HCFStack *stk__) UNUSED;
diff --git a/src/bindings/cpp/hammer/hammer_test.hpp b/src/bindings/cpp/hammer/hammer_test.hpp
index 77e6daa3..f3ab77a3 100644
--- a/src/bindings/cpp/hammer/hammer_test.hpp
+++ b/src/bindings/cpp/hammer/hammer_test.hpp
@@ -5,7 +5,7 @@
 #include <gtest/gtest.h>
 #include <hammer/hammer.hpp>
 
-#define HAMMER_DECL_UNUSED __attribute__((unused))
+#define HAMMER_DECL_UNUSED H_GCC_ATTRIBUTE((unused))
 
 static ::testing::AssertionResult ParseFails (hammer::Parser parser,
 					      const std::string &input) HAMMER_DECL_UNUSED;
diff --git a/src/bindings/desugar-header.pl b/src/bindings/desugar-header.pl
index 5bdd11e6..e836ad7a 100644
--- a/src/bindings/desugar-header.pl
+++ b/src/bindings/desugar-header.pl
@@ -11,7 +11,7 @@ while(<>) {
   } elsif (/^HAMMER_FN_DECL\(([^,]*), ([^,]*), ([^)]*)\);/) {
     print "$1 $2($3);\n";
     print "$1 $2__m(HAllocator* mm__, $3);\n";
-  } elsif (/^HAMMER_FN_DECL_VARARGS_ATTR\((__attribute__\(\([^)]*\)\)), ([^,]*), ([^,]*), ([^)]*)\);/) {
+  } elsif (/^HAMMER_FN_DECL_VARARGS_ATTR\((H_GCC_ATTRIBUTE\(\([^)]*\)\)), ([^,]*), ([^,]*), ([^)]*)\);/) {
     print "$2 $3($4, ...);\n";
     print "$2 $3__m(HAllocator *mm__, $4, ...);\n";
     print "$2 $3__a(void* args);\n";
-- 
GitLab