From 3b74aa9059aefe4ce82ecab1a5fd48cd251600dc Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 25 Aug 2011 20:28:26 -0700 Subject: [PATCH] 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. --- src/language/control/control-stack.h | 9 ++++++++- src/language/lexer/lexer.h | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) 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" -- 2.30.2