Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the GNU Bison option -H #4327

Closed
piotrsiupa opened this issue Mar 20, 2023 · 1 comment · Fixed by #4330
Closed

Add support for the GNU Bison option -H #4327

piotrsiupa opened this issue Mar 20, 2023 · 1 comment · Fixed by #4330
Labels
Tools Issues related to tools subsystem

Comments

@piotrsiupa
Copy link

piotrsiupa commented Mar 20, 2023

SCons doesn't recognize the option -H.
It should update the list of output files when the option is encountered. The option -H is the same as --header or --defines which are currently supported. (Well, kinda. See: #4326)
(https://www.gnu.org/software/bison/manual/bison.html#Output-Files)

  • Link to SCons Users thread discussing your issue. - https://discord.com/channels/571796279483564041/571796280146133047/1087434623476301836
  • Version of SCons - v4.5.1.49578b34582d9e92dac7d713a8e58599ae35aa63
  • Version of Python - 3.10.6
  • Which python distribution if applicable (python.org, cygwin, anaconda, macports, brew,etc) - the one from Ubuntu repository
  • How you installed SCons - through pip
  • What Platform are you on? (Linux/Windows and which version) - Linux Mint
  • How to reproduce your issue? Please include a small self contained reproducer. Likely a SConstruct should do for most issues. - it's below
  • How you invoke scons (The command line you're using "scons --flags some_arguments") - scons
targets = CFile('foo.y', YACCFLAGS='-d')
print('Flag `-d` (correct target list):', targets)

targets = CFile('bar.y', YACCFLAGS='-H')
print('Flag `-H` (incorrect target list):', targets)
@mwichmann
Copy link
Collaborator

mwichmann commented Mar 20, 2023

Seems "obvious", but it's a little harder to parse: --header (and its now-obsolete synonym --defines) use an = to indicate there's a following option-argument (filename). -H does not, you have to just concatenate the filename directly with the option (same for -g).

@mwichmann mwichmann added the Tools Issues related to tools subsystem label Mar 20, 2023
mwichmann added a commit to mwichmann/scons that referenced this issue Mar 23, 2023
The yacc tool now recognizes the bison syntax of using --header, --defines
and --graph options in YACCFLAGS without supplying an option argument.
Note that byacc doesn't allow leaving off the option argument, and would
error out in such cases.

Fixes SCons#4326

The yacc tool now recognizes -H as a partial synonym for --header.
It only works in the no-option-argument form - giving an option argument
will likely break things.

Fixes SCons#4327

Tests are expanded to cover these.

The graph file name (-g) is now generated relative to the requested
target file name, not to the source name, to match actual current
behavior. This is rare case - only kicks in if target explicitly requested
with a different base name than source - in this case SCons would emit a
different name than bison produces.  Unlikely to affect any real usage -
you would have to set up the condition described, and additionally use
the graph file as a source for some other build target.

The default file suffix for graph files is set to .gv, which is current
for Bison as of 1.38.  The previous suffix for Bison, dating back to 2.4,
was .dot, which is still the suffix byacc uses.  Docs updated to better
describe when you need to set this. The former default, .vcg, has not
been used since 2006.

Documentation updated for the two header suffix construction variables
to better describe (I hope) what these mean and when to set them. Other
doc updates as well.

Signed-off-by: Mats Wichmann <[email protected]>
@mwichmann mwichmann mentioned this issue Mar 23, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tools Issues related to tools subsystem
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants