#963 long long - MSVCRT - ANSI

closed-fixed
gcc (462)
2008-06-14
2006-09-08
Acerola
No

The source code (main.c) is a simple "hello world":

#include <stdio.h>

int main() {

printf("hello world");

return 0;

}

If I compile with:

C:/MinGW/bin/gcc.exe -ansi -pedantic-errors -o main
main.c

No problems. But if I compile with:

C:/MinGW/bin/gcc.exe -ansi -pedantic-errors -I
"C:\MinGW\include" -o main main.c

I get:

C:/MinGW/include/stdio.h:330: error: ISO C90 does not
support `long long'

In stdio.h we have:

#ifdef __MSVCRT__
typedef long long fpos_t;
#else
typedef long fpos_t;
#endif

But __MSVCRT__ is not defined anywhere! If I use the -
I option, this macro gets defined?

I am using:
gcc-core-3.4.5-20060117-1.tar.gz
binutils-2.16.91-20060119-1.tar.gz
mingw-runtime-3.9.tar.gz
w32api-3.6.tar.gz

Discussion

  • Danny Smith

    Danny Smith - 2006-09-08

    Logged In: YES
    user_id=11494

    This
    -I "C:\MinGW\include"
    results in stdio.h being included as an ordinary header,
    rather than a system header.

    When it is included as a system header -pedantic warnings
    are disabled.

    The reason that "C:\MinGW\include" is not recogonized as a
    system header is because GCC uses inode numbers to
    distinguish that directories are indeed different. Inode
    numbers are meaningless on windows file system. The 'bug'
    in gcc can be fixed but nobody, including myself, has
    considered it important enough.

    The __MSVCRT__ define is a builtin compiler define. It
    says that we are using msvcrt.dll as runtime, rather than
    the older crtdll.dll.

    If you add this to top of stdio.h and other runtime headers

    #if __GNUC__ >= 3
    pragam GCC system_header
    #endif

    the pedantic warnings will always be disabled.

    Danny

     
  • Danny Smith

    Danny Smith - 2008-06-14
    • labels: 103945 --> gcc
    • assigned_to: nobody --> dannysmith
    • status: open --> closed-fixed
     
  • Danny Smith

    Danny Smith - 2008-06-14

    Logged In: YES
    user_id=11494
    Originator: NO

    This is fixed on GCC trunk (4.4.0)
    Danny

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks