[PATCH][GOLD] Fix build breakage on OSX due to unintended macro substitution.
Doug Kwan (關振德)
dougkwan@google.com
Mon Jan 11 05:13:00 GMT 2010
Hi,
This is fixes one of the problems that break OSX build of gold.
The problem is caused by an implicit inclusion of assert.h in library
headers we use and a use of assert as an argument to the macro
DEFINE_var.
-Doug
2010-01-10 Doug Kwan <dougkwan@google.com>
* options.h (EMPTY_PARAMETER_LIST): New macro.
(DEFINE_var): Use EMPTY_PARAMETER_LIST to avoid unintended subsequent
macro substitutions.
-------------- next part --------------
Index: gold/options.h
===================================================================
RCS file: /cvs/src/src/gold/options.h,v
retrieving revision 1.136
diff -u -p -r1.136 options.h
--- gold/options.h 7 Jan 2010 18:31:30 -0000 1.136
+++ gold/options.h 11 Jan 2010 05:04:57 -0000
@@ -238,6 +238,13 @@ struct Struct_special : public Struct_va
} // End namespace options.
+// This is defined to avoid unintended macro substitutions in DEFINE_var below.
+// On Mac OSX, assert.h is included transitively by some other library headers
+// we use. We need to use EMPTY_PARAMETER_LIST to avoid assert() being
+// substituted as a macro when the "assert" command line option is defined.
+// Note that this only deals with function-like macros.
+
+#define EMPTY_PARAMETER_LIST ()
// These are helper macros use by DEFINE_uint64/etc below.
// This macro is used inside the General_options_ class, so defines
@@ -249,7 +256,7 @@ struct Struct_special : public Struct_va
optional_arg__, type__, param_type__, parse_fn__) \
public: \
param_type__ \
- varname__() const \
+ varname__ EMPTY_PARAMETER_LIST const \
{ return this->varname__##_.value; } \
\
bool \
More information about the Binutils
mailing list