开发者

Why does GCC seem much more verbose in Ubuntu 10?

I have recently made a cp clone (for University) and I happened to discover something I had never got the chance to.

This applies at least to GCC compiling a C source.

I did the main development of this specific C program in a Mac OS X (10.6.4), builds with Apple's /usr/bin/gcc --version

i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)
Copyright (C) 2007 Free Software Foundation, Inc.

However, I ran the tests in an Arch Linux virtual machine within the Mac, with the latest gcc (no additions, no customizations, no mods like Apple's)

gcc (GCC) 4.5.1
Copyright (C) 2010 Free Software Foundation, Inc.

And we had to build it in the class in the Ubuntu 10.04.1 LTS that we have there.

My Makefile was something like:

CC=gcc
#CFLAGS=-O0 -g -Wall
CFLAGS=-O3 -Wall -finline-functions
EXE=copy

compile:
    $(CC) $(CFLAGS) -o $(EXE) main.c

So, I was always running (in every OS) gcc with -Wall enabled. Mac and Arch never showed any warning.

Ubuntu printed two warnings, with and without -Wall

do_copy.c: In function 'do_copy_file2file':
do_copy.c:27: warning: ignoring return value of 'realpath', declared with attribute warn_unused_result
do_copy.c: In function 'do_copy_symlink2file':
do_copy.c:117: warning: ignoring return value of 'symlink', declared with attribute warn_unused_result

Ubuntu's GCC version is the default for the distribution: gcc (Ubuntu 4.4.3-ubuntu5) 4.4.3

Why does that happen?

Why don't I see any warnings in the other two OS开发者_JAVA技巧s and in Ubuntu I do?


Ubuntu enforces some CFLAGS as you can see here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜