diff options
author | Jim Meyering <meyering@redhat.com> | 2012-01-23 11:47:46 +0100 |
---|---|---|
committer | Akim Demaille <demaille@gostai.com> | 2012-01-25 08:50:14 +0100 |
commit | c373ab641b69a25bfd5f18b6e4243a7feada5aaf (patch) | |
tree | 92ef8b0b2143cd9e21395e61094366fc5f16dcca | |
parent | b3597047475134a08eaf301d62c2e61b332690a9 (diff) | |
download | bison-c373ab641b69a25bfd5f18b6e4243a7feada5aaf.tar.gz |
build: avoid possibly-replaced fprintf in liby-source, yyerror.c
* lib/yyerror.c (yyerror): Use fputs and fputc rather than fprintf
with a mere "%s\n" format. Always return 0 now, on the assumption
that the return value was never used anyway.
Don't include <config.h> after all. This avoids a problem
reported by Thiru Ramakrishnan in
http://lists.gnu.org/archive/html/help-bison/2011-11/msg00000.html
* cfg.mk: Exempt lib/yyerror.c from the sc_require_config_h_first test.
* THANKS: Update.
(cherry picked from commit fb9eea88856d73a5f25295a52f6d4df7fabc565b)
-rw-r--r-- | THANKS | 1 | ||||
-rw-r--r-- | cfg.mk | 3 | ||||
-rw-r--r-- | lib/yyerror.c | 5 |
3 files changed, 6 insertions, 3 deletions
@@ -97,6 +97,7 @@ Sergei Steshenko sergstesh@yahoo.com Shura debil_urod@ngs.ru Steve Murphy murf@parsetree.com Summum Bonum sum@geekhouse.org +Thiru Ramakrishnan thiru.ramakrishnan@gmail.com Tim Josling tej@melbpc.org.au Tim Landscheidt tim@tim-landscheidt.de Tim Van Holder tim.van.holder@pandora.be @@ -55,4 +55,5 @@ update-copyright-env = \ UPDATE_COPYRIGHT_FORCE=1 UPDATE_COPYRIGHT_USE_INTERVALS=1 exclude_file_name_regexp--sc_space_tab = ^tests/(input|c\+\+)\.at$$ -exclude_file_name_regexp--sc_require_config_h_first = ^data/(glr|yacc)\.c$$ +exclude_file_name_regexp--sc_require_config_h_first = \ + ^(lib/yyerror|data/(glr|yacc))\.c$$ diff --git a/lib/yyerror.c b/lib/yyerror.c index 5eb339fa..c9f492f8 100644 --- a/lib/yyerror.c +++ b/lib/yyerror.c @@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <config.h> #include <stdio.h> int yyerror (char const *); @@ -25,5 +24,7 @@ int yyerror (char const *); int yyerror (char const *message) { - return fprintf (stderr, "%s\n", message); + fputs (message, stderr); + fputc ('\n', stderr); + return 0; } |