为什么GCC似乎更详细的在Ubuntu 10?
题
我最近做了一个CP克隆(对大学),我偶然发现一些我从来没有得到机会。
这至少适用于GCC编译C源。
我没有在Mac OS X的这个特定的C程序(10.6.4),建立与苹果的/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.
不过,我跑了Mac中的处于Arch Linux的虚拟机测试,以最新的海湾合作委员会(无添加,无定制,无MODS像苹果的)
gcc (GCC) 4.5.1
Copyright (C) 2010 Free Software Foundation, Inc.
,我们不得不建立它在Ubuntu的LTS 10.04.1类,我们已经在那里。
我的Makefile是这样的:
CC=gcc
#CFLAGS=-O0 -g -Wall
CFLAGS=-O3 -Wall -finline-functions
EXE=copy
compile:
$(CC) $(CFLAGS) -o $(EXE) main.c
所以,我总是跑(每OS)与-Wall
GCC启用。
Mac和拱门从未表现出任何警告。
Ubuntu的印刷两个警告,与并没有强> -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的GCC版本是用于分配的缺省值:
gcc (Ubuntu 4.4.3-ubuntu5) 4.4.3
为什么会这样?
为什么我看不到在其他两个操作系统和在Ubuntu我任何的警告吗?
解决方案
Ubuntu的强制执行一些CFLAGS,你可以看到这里
不隶属于 StackOverflow