When I use the default C compiler cc on macOS to compile a parser generated by GNU Bison I get the following warning:

y.tab.c:3974:18: warning: format string is not a string literal
      (potentially insecure) [-Wformat-security]
        yyerror (yymsgp);
                 ^~~~~~
y.tab.c:3974:18: note: treat the string as an argument to avoid this
        yyerror (yymsgp);
                 ^
                 "%s",

As the warning suggests, GNU Bison should instead generate the call

        yyerror ("%s", yymsgp);


$ yacc --version
bison (GNU Bison) 3.3.2
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cc --version
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin


-- August

Reply via email to