Re: "make distcheck" fails

Bruno Haible <[email protected]>
Newsgroups gmane.comp.gnu.m4.bugs
Message-ID <4301427.trh7XvIz5z@omega>
Hi Paul,

> > I can reproduce it on an Ubuntu 16.04.x machine:
> 
> > m4.c:166:1: error: function might be candidate for attribute 'pure' if it is known to return normally [-Werror=suggest-attribute=pure]
> >   fault_handler (int signo)
> >   ^
> 
> ...
> 
> > It is not clear to me whether the function 'fault_handler' should be
> > marked with attribute 'pure' or not.
> 
> 'pure' does sound dicey, as the intent is for 'pure' to be useful to a compiler 
> when doing optimization and it's satisfying that intent, but on the other hand 
> the function does have side effects visible to the caller.

I was hesitating as well, until I read the first sentence in the description
of 'pure':
  "Calls to functions that have no observable effects on the state of the program
   other than to return a value..."
Evidently _exit(1) is a side effect (the biggest side effect a function can have).
So, 'fault_handler' should not be marked 'pure'.

> Anyway, GCC 10.1 doesn't issue the diagnostic for me, I hope because GCC has 
> been improved since the GCC 5 that comes with Ubuntu 16.04.

Right, it's corrected in GCC 8 or newer.

> So I hope we can 
> leave this alone, as we can assume that whoever prepares m4 distributions has a 
> more-modern GCC.

OK. I've switched the weekly tarball generator [2] to use Ubuntu 20.04; it
contains a GCC >= 8.

Bruno

[1] https://gcc.gnu.org/onlinedocs/gcc-10.1.0/gcc/Common-Function-Attributes.html
[2] https://gitlab.com/gnu-m4/ci-distcheck
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.