• lcc-win bug: __STDC_LIB_EXT1__

    From Keith Thompson@21:1/5 to All on Sat Feb 10 15:57:00 2018
    (I reported this by e-mail, but I haven't gotten a response.)

    I installed lccwin64 (downloaded from https://lcc-win32.services.net/lccwin64.exe) under Windows 10.

    "lc -v" reports:
    Logiciels/Informatique lcc-win32 version 3.8. Compilation date: Mar 29 2013 13:11:27
    lcclnk version 1.3

    "lc64 -v" reports:
    Logiciels/Informatique lcc-win (64 bits) version 4.1.
    Compilation date: Oct 27 2016 16:34:50

    The bug appears with both "lc" and "lc64".

    Here's a test program that checks the setting of __STDC_ISO_10646__:

    #include <stdio.h>
    int main(void) {
    #ifdef __STDC_ISO_10646__
    puts("__STDC_ISO_10646__ is defined");
    printf(" Its value is %ld\n", __STDC_ISO_10646__);
    #else
    puts("__STDC_ISO_10646__ is not defined");
    #endif
    }

    It correctly prints

    __STDC_ISO_10646__ is not defined

    Here's another program, identical except for replacing
    __STDC_ISO_10646__ by __STDC_LIB_EXT1__.

    #include <stdio.h>
    int main(void) {
    #ifdef __STDC_LIB_EXT1__
    puts("__STDC_LIB_EXT1__ is defined\n");
    printf(" Its value is %ld\n", __STDC_LIB_EXT1__);
    #else
    puts("__STDC_LIB_EXT1__ is not defined");
    #endif
    }

    It fails at compile time:

    Error stdc_libc_ext1.c: 5 illegal expression
    Error stdc_libc_ext1.c: 5 syntax error; found `;' expecting ')'
    2 errors, 0 warnings
    1 error

    I think the problem is that the compiler is defining __STDC_LIB_EXT1__
    as an empty token sequence. My reading of 6.10.8.3 is that it must
    either be defined as 201112L or left undefined. (The value is given
    incorrectly in N1570 and in the C11 standard, but is corrected in C11
    TC1.)

    I ran into this when trying to compile my show_c_types project, https://github.com/Keith-S-Thompson/show_c_types.

    --
    Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst> Working, but not speaking, for JetHead Development, Inc.
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)