lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Treacherous gcc-10 defect


From: Vadim Zeitlin
Subject: Re: [lmi] Treacherous gcc-10 defect
Date: Tue, 2 Mar 2021 14:12:46 +0100

On Mon, 1 Mar 2021 17:06:20 +0000 Greg Chicares <gchicares@sbcglobal.net> wrote:

GC> We'll use it for gcc-11 of course, but not for gcc-10 unless
GC> we can devise a good way to detect the full version.
[...]
GC> I suppose we could compile a program that would emit the gcc
GC> version as stored in predefined macros
GC>   __GNUC__
GC>   __GNUC_MINOR__
GC>   __GNUC_PATCHLEVEL__
GC> or, better...
GC> 
GC> $x86_64-w64-mingw32-g++  -x c++ -dM -E -std=c++11 - < /dev/null |grep 
__GNUC_
GC> #define __GNUC__ 10
GC> #define __GNUC_PATCHLEVEL__ 0
GC> #define __GNUC_STDC_INLINE__ 1
GC> #define __GNUC_MINOR__ 2
GC> 
GC> ...which works for 8.3.0 as well.
GC> 
GC> This seems like too much labor when '-dumpfullversion' should Just Work.

 This is indeed too much work for every single test but, generally
speaking, running a test program is a quite simple and direct way of
finding out some information affecting the program compilation and it's not
a coincidence that all higher-level build systems provide some simple way
of doing it.

 And I think it should be possible to implement the equivalent of autoconf
AC_TRY_COMPILE() macro with just GNU make macros. Whether we want to do it
or not is another question, because it's likely to be somewhat hairy. But I
think being able to do something like

        define check_gcc_10_2_1
        #if __GNUC__ < 10 || __GNUC_MINOR__ < 2 || __GNUC_PATCHLEVEL__ < 1
        #error Not gcc 10.2.1 or later
        #endif
        endef
        ifeq (check_compile($check_gcc_10_2_1),1)
        ...
        endif

would be convenient not only here but in other places too.

 As usual, all this is just idle musings, please let me know if you think
it would be worth really looking into this,
VZ

Attachment: pgpKblxaIt2Sc.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]