about summary refs log tree commit diff
path: root/stdlib/system.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2018-11-30 15:20:41 +0000
committerJoseph Myers <joseph@codesourcery.com>2018-11-30 15:20:41 +0000
commit7e1d42400c1b8f03316fe14176133c8853cd3bbe (patch)
treec34eb3317fd3d98b8e4ca27b409621e9238d9a24 /stdlib/system.c
parentce7387cc250a408d3fbb7a6fff7ad4d977166b00 (diff)
downloadglibc-7e1d42400c1b8f03316fe14176133c8853cd3bbe.tar.gz
glibc-7e1d42400c1b8f03316fe14176133c8853cd3bbe.tar.xz
glibc-7e1d42400c1b8f03316fe14176133c8853cd3bbe.zip
Replace gen-as-const.awk by gen-as-const.py.
This patch replaces gen-as-const.awk, and some fragments of the
Makefile code that used it, by a Python script.  The point is not such
much that awk is problematic for this particular script, as that I'd
like to build up a general Python infrastructure for extracting
information from C headers, for use in writing tests of such headers.
Thus, although this patch does not set up such infrastructure, the
compute_c_consts function in gen-as-const.py might be moved to a
separate Python module in a subsequent patch as a starting point for
such infrastructure.

The general idea of the code is the same as in the awk version, but no
attempt is made to make the output files textually identical.  When
generating a header, a dict of constant names and values is generated
internally then defines are printed in sorted order (rather than the
order in the .sym file, which would have been used before).  When
generating a test that the values computed match those from a normal
header inclusion, the test code is made into a compilation test using
_Static_assert, where previously the comparisons were done only when
the test was executed.  One fragment of test generation (converting
the previously generated header to use asconst_* prefixes on its macro
names) is still in awk code in the makefiles; only the .sym processing
and subsequent execution of the compiler to extract constants have
moved to the Python script.

Tested for x86_64, and with build-many-glibcs.py.

	* scripts/gen-as-const.py: New file.
	* scripts/gen-as-const.awk: Remove.
	* Makerules ($(common-objpfx)%.h $(common-objpfx)%.h.d): Use
	gen-as-const.py.
	($(objpfx)test-as-const-%.c): Likewise.
Diffstat (limited to 'stdlib/system.c')
0 files changed, 0 insertions, 0 deletions