diff --git a/src/backends/contextfree.h b/src/backends/contextfree.h
index 9105636f1d19a06bf9c69fc1484338c485904655..29b51a08ac3c39251170ce50f6c85448f5adf65f 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 77e6daa3fccd31d296d3d364a75bcc0cce5d7354..f3ab77a377d569a3b42255b050e7d6d8324837aa 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 5bdd11e665b86af623583a94002551795d7b9ade..e836ad7a8bd0af6299008696f22f2f9a549d4b82 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";