Skip to content
Snippets Groups Projects
  • Arseny Kapoulkine's avatar
    2ec3579f
    Work around gcc issues with limits.h not defining LLONG_MIN · 2ec3579f
    Arseny Kapoulkine authored
    It looks like there are several cases where this might happen:
    
    - In some MinGW distributions, the LLONG_MIN/etc defines are guarded
    with:
    
    	#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
    
    Which means that you don't get them in strict ANSI mode. The previous
    workaround was specifically targeted towards this.
    
    - In some GCC distributions (notably GCC 6.3.0 in some configurations),
    LLONG_MIN/etc. defines are guarded with:
    
    	#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
    
    But __STDC_VERSION__ isn't defined as C99 even if you use -std=c++14 -
    which is probably technically valid, but not useful.
    
    To work around this, redefine the symbols whenever we are building with
    GCC and we need them and they aren't defined - doing this is better than
    not building. Instead of hard-coding the constants, use GCC-specific
    __LONG_LONG_MAX__ to compute them.
    
    Fixes #181.
    2ec3579f
    History
    Work around gcc issues with limits.h not defining LLONG_MIN
    Arseny Kapoulkine authored
    It looks like there are several cases where this might happen:
    
    - In some MinGW distributions, the LLONG_MIN/etc defines are guarded
    with:
    
    	#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
    
    Which means that you don't get them in strict ANSI mode. The previous
    workaround was specifically targeted towards this.
    
    - In some GCC distributions (notably GCC 6.3.0 in some configurations),
    LLONG_MIN/etc. defines are guarded with:
    
    	#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
    
    But __STDC_VERSION__ isn't defined as C99 even if you use -std=c++14 -
    which is probably technically valid, but not useful.
    
    To work around this, redefine the symbols whenever we are building with
    GCC and we need them and they aren't defined - doing this is better than
    not building. Instead of hard-coding the constants, use GCC-specific
    __LONG_LONG_MAX__ to compute them.
    
    Fixes #181.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.