Repository navigation
yacc tool updates - #4330
yacc tool updates#4330
Conversation
|
can we add that blurb about files with the yacc tool, instaed of CFile() ? |
|
If a user is using an old version of bison or byacc would SCons' expected output files now be incorrect? |
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 3.8. 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]>
Per review requests Signed-off-by: Mats Wichmann <[email protected]>
bd69915 to
2ef2269
Compare
The only confusion could be about the graph file, where bison has changed file format once, and names twice; byacc has used the same format/suffix since they introduced the feature. This only matters in the quite unlikely case that the graph file is used as the source to some other build - it's intended as a diagnostic output, not as something you'd use as part of a build. It only matters to us so there's something to "clean". A bison old enough to notice the change would be 17+ years old. |
|
I've updated (RELEASE, doc). Rebasing to current meant I had to force-push so things here will be out of sync. |
|
The failure here is very odd: The other windows runs didn't take this problem, and because it's an emulated tool ( |
After a REALLY QUICK (and possibly misguided) experiment, it appears that 3.6 needs a space after the "-I". This fails in 3.6: "-Iout -Iin" Both seem to work in 3.8. |
|
Thanks for that. Maybe this is something in the |
Couldn't this be used to generate some document for the software being built? |
|
Maybe wait for someone to request that? |
|
To follow up on the error a bit, here's the thing that goes wrong extracted - I can reproduce this fail on Linux also: $ python3.6 myyacc.py -x -Iout -Iin -o out/aaa.c in/aaa.y
usage: myyacc.py [-h] [-g [GRAPH]] [-d] [-v] [-x] [-H [HEADER]] -o OUT
[-I I_ARGUMENTS]
files [files ...]
myyacc.py: error: unrecognized arguments: -Iout -Iin
$ python3.7 myyacc.py -x -Iout -Iin -o out/aaa.c in/aaa.y
usage: myyacc.py [-h] [-g [GRAPH]] [-d] [-v] [-x] [-H [HEADER]] -o OUT
[-I I_ARGUMENTS]
files [files ...]
myyacc.py: error: unrecognized arguments: -Iout -Iin
$ python3.8 myyacc.py -x -Iout -Iin -o out/aaa.c in/aaa.y
$So 3.6 and 3.7 fail this, 3.8 and later passes. The argparse docs don't list any 3.8 behavioral change that could affect this, so presumably it was a "bugfix". Since the argument isn't a yacc argument but something specific to the mock command, we can fix this up in the test by including the space so it works on all versions. The mock command needs a tweak for that. |
When the mock tool was revised to use argparse instead of getopt, it stumbled across the problem that argparse apparently doesn't deal with a single-letter option and its option-argument not having a space between them until Python 3.8 - 3.6 and 3.7 failed the test. Change to use the space in the test/mock tool. Signed-off-by: Mats Wichmann <[email protected]>
Signed-off-by: Mats Wichmann <[email protected]>
A review request suggested removing the note in CFile/CXXFile tool doc on yacc filenames. I removed only the CFile one, this does the CXXFile one as well. Signed-off-by: Mats Wichmann <[email protected]>
|
So here's my concern. Often parsers depend on a specific version of bison/yacc/byacc. Changing the version may introduce changes which will break the logic. But as you said this is only for the graph output file? |
|
I suppose. bison switched way long ago to using The Further, you can specify the filename you want via other mechanisms. These are just ugly compat things that don't really work well with SCons anyway - Does that make you any happier? |
… be tied to the suffix string. It will respect the previous value if it's not set. Added test for such
Changed to YACC_GRAPH_FILE_SUFFIX. and some other changes
Signed-off-by: Mats Wichmann <[email protected]>
|
Cleaned up conflicts. |
The yacc tool now recognizes the bison syntax of using
--header,--definesand--graphoptions inYACCFLAGSwithout supplying an option argument. Note that byacc doesn't allow leaving off the option argument, and would error out in such cases.Fixes #4326
The yacc tool now recognizes
-Has a partial synonym for--header. It only works in the no-option-argument form - giving an option argument will likely break things.Fixes #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 bison 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.Obsoleted
YACCVCGFILESUFFIX, being replaced byYACC_GRAPH_FILE_SUFFIX. IfYACC_GRAPH_FILE_SUFFIXis not set, it will respectYACCVCGFILESUFFIX.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.
Contributor Checklist:
CHANGES.txt(and read theREADME.rst)