[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft-devel] A few compiler warnings from Mac OS's gcc.
From: |
Alan Coopersmith |
Subject: |
Re: [ft-devel] A few compiler warnings from Mac OS's gcc. |
Date: |
Sat, 01 Mar 2014 11:10:20 -0800 |
User-agent: |
Mozilla/5.0 (X11; SunOS i86pc; rv:17.0) Gecko/20131203 Thunderbird/17.0.6 |
On 03/ 1/14 10:41 AM, suzuki toshiya wrote:
Hmm. I will try to find any combinations can simulate
-pedantic except of -Wlong-long.
Can't you just use the -std=c99 flag to tell GCC to only be pedantic
about things not in the now-15-year-old C99 standard, instead of going
back to the older C89?
With this simple test case:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
long long sum = 0;
int i;
for (i = 1; i < argc; i++) {
sum += strtol(argv[i], NULL, 0);
}
printf("sum = %lld\n", sum);
return 0;
}
I get warnings from gcc in default/c89 mode, but not explicit c99 mode:
% /usr/gcc/3.4/bin/gcc -Wall -pedantic -o longlong longlong.c
longlong.c: In function `main':
longlong.c:6: warning: ISO C90 does not support `long long'
longlong.c:13: warning: ISO C90 does not support the `ll' printf length modifier
% /usr/gcc/3.4/bin/gcc -std=c99 -Wall -pedantic -o longlong longlong.c
[no warnings]
gcc 4.7 operates the same for me.
--
-Alan Coopersmith- address@hidden
Oracle Solaris Engineering - http://blogs.oracle.com/alanc