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
This commit is contained in:
Nicolas Léveillé 2015-08-09 18:37:07 +02:00
parent 6b9ba6033e
commit c8726244ae
3 changed files with 3 additions and 3 deletions

View file

@ -22,7 +22,7 @@ struct HCFStack_ {
}; };
#ifndef UNUSED #ifndef UNUSED
#define UNUSED __attribute__((unused)) #define UNUSED H_GCC_ATTRIBUTE((unused))
#endif #endif
static inline HCFChoice* h_cfstack_new_choice_raw(HAllocator *mm__, HCFStack *stk__) UNUSED; static inline HCFChoice* h_cfstack_new_choice_raw(HAllocator *mm__, HCFStack *stk__) UNUSED;

View file

@ -5,7 +5,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <hammer/hammer.hpp> #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, static ::testing::AssertionResult ParseFails (hammer::Parser parser,
const std::string &input) HAMMER_DECL_UNUSED; const std::string &input) HAMMER_DECL_UNUSED;

View file

@ -11,7 +11,7 @@ while(<>) {
} elsif (/^HAMMER_FN_DECL\(([^,]*), ([^,]*), ([^)]*)\);/) { } elsif (/^HAMMER_FN_DECL\(([^,]*), ([^,]*), ([^)]*)\);/) {
print "$1 $2($3);\n"; print "$1 $2($3);\n";
print "$1 $2__m(HAllocator* mm__, $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($4, ...);\n";
print "$2 $3__m(HAllocator *mm__, $4, ...);\n"; print "$2 $3__m(HAllocator *mm__, $4, ...);\n";
print "$2 $3__a(void* args);\n"; print "$2 $3__a(void* args);\n";