[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: max_align_t fails with clang 6.1 on OS X 10.10
From: |
Bruno Haible |
Subject: |
Re: max_align_t fails with clang 6.1 on OS X 10.10 |
Date: |
Sun, 03 Sep 2017 12:01:07 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-93-generic; KDE/5.18.0; x86_64; ; ) |
Werner LEMBERG wrote:
> > Could you try incorporating the std-gnu11 module into your package,
> > and see whether that fixes things? If so, perhaps we could fix this
> > problem for everybody by having stddef depend on std-gnu11.
>
> This approach worked
Nevertheless, I don't agree that this is the solution.
What you are trying to do is to run the configure tests with a C compiler
and then use the resulting config.h with C code [1] and C++ code [2].
[1] http://repo.or.cz/ttfautohint.git/tree/HEAD:/lib
[2] http://repo.or.cz/ttfautohint.git/tree/HEAD:/frontend
This is not supported by Autoconf, and this is not supported by Gnulib -
simply because _any_ test result (not just the one for max_align_t) may
be different in C++ than it is in C.
There is one real fix for this problem: You create separate configure.ac
files for the lib/ and for the frontend directory, and each of them uses
a separate gnulib-tool invocation. (So, you must use the options --lib
and --source-base of gnulib-tool, to make sure the two gnulib-tool results
don't interfere.) The configure.ac for frontend/ must use AC_LANG_PUSH([C++])
before gl_INIT.
This fix is future-proof: It will work even after
- you request additional gnulib modules,
- the C standard features change,
- the C++ standard features change.
The other approaches are brittle: If we/you change something regarding
the max_align_t problem, you will continue to see issues
- on other platforms,
- when you request additional gnulib modules,
- when the C standard features change,
- when the C++ standard features change.
Among these other approaches are the following:
* You could add gnulib module 'std-gnu11' to the list of gnulib modules
you request. This has the chance of fixing other problems than the
max_align_t one, because C++ is closer to C11 than it is to C99.
But still, newer C or C++ standard can bring new problems.
* Gnulib could add a dependency from 'stddef' to 'std-gnu11'. I reject
this idea because this is a big change that affects all users, for a
situation that is not supported.
* Gnulib could test something like
HAVE_MAX_ALIGN_T || (defined(__APPLE__) && defined(__MACH__) &&
defined(__cplusplus))
instead of
HAVE_MAX_ALIGN_T
This is not such a big change, but it is brittle code, may only fix
the max_align_t problem, and is for a situation that is not supported.
In summary, I don't think Gnulib should change here, and you still the choice
among a real fix and a quick-fix.
Bruno