]> git.ipfire.org Git - thirdparty/glibc.git/commit - scripts/gen-as-const.py
Make gen-as-const.py handle '--' consistently with awk script.
authorJoseph Myers <joseph@codesourcery.com>
Mon, 3 Dec 2018 22:08:50 +0000 (22:08 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Mon, 3 Dec 2018 22:08:50 +0000 (22:08 +0000)
commit477a02f63751c4b759ddd9454d17f2a7ad120ee3
tree173ff9af686792eb3bb9caab2300e8f5e5d56dcc
parent6af956e5c019637051ba8cfb46cfff9bbe574500
Make gen-as-const.py handle '--' consistently with awk script.

It was reported in
<https://sourceware.org/ml/libc-alpha/2018-12/msg00045.html> that
gen-as-const.py fails to generate test code in the case where a .sym
file has no symbols in it, so resulting in a test failing to link for
Hurd.

The relevant difference from the old awk script is that the old script
treated '--' lines as indicating that the text to do at the start of
the test (or file used to compute constants) should be output at that
point if not already output, as well as treating lines with actual
entries for constants like that.  This patch changes gen-as-const.py
accordingly, making it the sole responsibility of the code parsing
.sym files to determine when such text should be output and ensuring
it's always output at some point even if there are no symbols and no
'--' lines, since not outputting it means the test fails to link.
Handling '--' like that also avoids any problems that would arise if
the first entry for a symbol were inside #ifdef (since the text in
question must not be output inside #ifdef).

Tested for x86_64, and with build-many-glibcs.py for i686-gnu.  Note
that there are still compilation test failures for i686-gnu
(linknamespace tests, possibly arising from recent posix_spawn-related
changes).

* scripts/gen-as-const.py (compute_c_consts): Take an argument
'START' to indicate that start text should be output.
(gen_test): Likewise.
(main): Generate 'START' for first symbol or '--' line, or at end
of input if not previously generated.
ChangeLog
scripts/gen-as-const.py