From: Ben Pfaff Date: Fri, 26 Aug 2011 03:28:26 +0000 (-0700) Subject: Fix build error if "close" macro is not always visible. X-Git-Tag: v0.7.9~150 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b74aa9059aefe4ce82ecab1a5fd48cd251600dc;p=pspp-builds.git Fix build error if "close" macro is not always visible. Harry Thijssen reported the following errors with recent Gnulib on Win32: src/language/lexer/lexer.c: In function 'lex_source_destroy': src/language/lexer/lexer.c:1455: error: 'const struct lex_reader_class' has no member named 'rpl_close' src/language/lexer/lexer.c:1456: error: 'const struct lex_reader_class' has no member named 'rpl_close' The problem was that the Gnulib substitute for defines close to rpl_close, but this macro definition wasn't visible when lexer.c included lexer.h and became visible later. This commit fixes the problem by making sure that the macro definition is always visible in lexer.h. A better solution would probably be to rename the 'close' member to something other than a standard POSIX function name. The change to control-stack.h is just precautionary; Harry didn't report the same problem there. --- diff --git a/src/language/control/control-stack.h b/src/language/control/control-stack.h index 083c6860..9c6824b5 100644 --- a/src/language/control/control-stack.h +++ b/src/language/control/control-stack.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,6 +19,13 @@ #include +/* The following #include avoids a potential problem when Gnulib substitutes + * for close() by putting "#define close rpl_close" into , by + * ensuring that every source file that includes this one sees the #define.. + * (It would probably be better to rename the 'close' member of struct + * ctl_class.) */ +#include + struct ctl_class { const char *start_name; /* e.g. LOOP. */ diff --git a/src/language/lexer/lexer.h b/src/language/lexer/lexer.h index b9e936bf..b35ea7f5 100644 --- a/src/language/lexer/lexer.h +++ b/src/language/lexer/lexer.h @@ -20,6 +20,13 @@ #include #include +/* The following #include avoids a potential problem when Gnulib substitutes + * for close() by putting "#define close rpl_close" into , by + * ensuring that every source file that includes this one sees the #define. + * (It would probably be better to rename the 'close' member of struct + * lex_reader_class.) */ +#include + #include "data/identifier.h" #include "data/variable.h" #include "libpspp/compiler.h"