Funny clang behaviour

Vincent Lefevre vincent at vinc17.net
Tue Feb 18 15:23:54 UTC 2020


On 2020-02-18 16:04:54 +0100, Niels Möller wrote:
> Vincent Lefevre <vincent at vinc17.net> writes:
> 
> >> Is there a way to tell automake to omit it in DEFAULT_INCLUDES?
> >
> > nostdinc?
> >
> > 8.7 Variables used when building a program
> > ==========================================
> >
> > [...]
> >      Automake already provides some ‘-I’ options automatically, in a
> >      separate variable that is also passed to every compilation that
> >      invokes the C preprocessor.  In particular it generates ‘-I.’,
> >      ‘-I$(srcdir)’, and a ‘-I’ pointing to the directory holding
> >      ‘config.h’ (if you’ve used ‘AC_CONFIG_HEADERS’).  You can disable
> >      the default ‘-I’ options using the ‘nostdinc’ option.
> > [...]
> 
> Seems worth exploring. And then add actually needed -I flags explicitly
> in each Makefile.am.
> 
> I agree that it would help a bit if something like -iquote was
> universally supported. And it's unhelpful that C++ standard headers
> don't use the .h suffix.

By adding a src/bits/types.h to the MPFR source, I could reproduce a
build failure with gcc (no C++).

I think that the best solution would be:
(1) disable the default -I options with nostdinc as documented;
(2) have a rule that copies needed files to $(top_builddir)/include;
(3) use "-I$(top_builddir)/include".

In (2), needed files are the included (.c, .h, etc.) files that may
come from a directory other than the current directory.

If -iquote were universally supported, then only headers would need
to be copied to $(top_builddir)/include (this would avoid even more
potential clashes).

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the gmp-devel mailing list