Re: FYI: 28-gary-sanitise-header-includes

Eric Blake <[email protected]>
Newsgroups gmane.comp.gnu.m4.patches
Message-ID <[email protected]>
Gary V. Vaughan <gary <at> gnu.org> writes:

> 
> 
> Applied to HEAD, after 4 days without comment.
> 
>   Index: ChangeLog
>   from  Gary V. Vaughan  <gary <at> gnu.org>
>   	M4 was designed to have a small number of header files defining
>   	the interfaces to several source files each.  Keeping this in
>   	mind allows us to tidy things up considerably.  Having done this,
>   	it becomes clear that some of the installed headers reference
>   	other headers which are not installed (but that's another patch):
> 
>   	* m4/system_.h (gnu/stdio--.h, gnu/stdlib--.h, gnu/unistd--.h):
>   	...to here, so client modules can benefit too.
>   	(assert.h, errno.h, limits.h, sys/stat.h): Include one here at the
>   	lowest level to save doing it multiple times elsewhere.
...
>   	* m4/path.c (config.h, stdlib.h): Ditto.

Oops.  This broke non-debug builds.  Sorry for not catching it sooner.

$ ./config.status --version
GNU M4 config.status 1.9a
configured by ./configure, generated by GNU Autoconf 2.61b,
  with options "'-C' 'CFLAGS=-ggdb -Wall' '--disable-assert' '--disable-nls' '--
enable-ltdl-convenience'"

ERROR: All 154 tests were run,
153 failed (2 expected failures).
## -------------------------- ##
## testsuite.log was created. ##
## -------------------------- ##

$ cat tests/testsuite.dir/001/testsuite.log
#                             -*- compilation -*-
1. macros.at:29: testing ...
./macros.at:59: m4 -b -d input.m4 < /dev/null
stderr:
m4:input.m4:5: Warning: define: extra arguments ignored: 3 > 2
m4:input.m4:10: Warning: defun: extra arguments ignored: 3 > 2
assertion "NODE_KEY (node) == NULL" failed: file "m4/hash.c", line 234
/home/eblake/m4-head/tests/testsuite: line 1391: 10548 Aborted                 (
core dumped) m4 -b -d input.m4 < /dev/null
./macros.at:59: exit code was 134, expected 0
1. macros.at:29: 1. Arity and defn (macros.at:29): FAILED (macros.at:59)

Cool - './configure --disable-assert' disables assertions, and yet we core 
dumped on an assertion failure! :)

I tracked the problem to the fact that hash.c was now compiled in such a way 
that <assert.h> was picked up prior to <config.h>, so assertions remained 
enabled; but then several slower preconditions are protected by NDEBUG, and got 
omitted; leading to a crash every time.

I am currently playing with a patch that follows gnulib policy of removing 
<config.h> from all .h, and making sure that it is the first line of all .c; 
hopefully that will clean up the problem.  Everything else may be factor-able 
into system_.h, but <config.h> must be handled specially if m4 source code is 
to see a consistent state.

-- 
Eric Blake
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.