bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #37069] POSIX specifies CC=c99


From: anonymous
Subject: [bug #37069] POSIX specifies CC=c99
Date: Fri, 10 Aug 2012 10:01:17 +0000
User-agent: Opera/9.80 (X11; Linux x86_64; U; en) Presto/2.10.289 Version/12.00

URL:
  <http://savannah.gnu.org/bugs/?37069>

                 Summary: POSIX specifies CC=c99
                 Project: make
            Submitted by: None
            Submitted on: Fri 10 Aug 2012 10:01:17 AM UTC
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 3.82
        Operating System: POSIX-Based
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:

The POSIX standard for make includes a number of predefined macros, including

CC=c99

where c99 is an ISO C99-compliant compiler. On a typical GNU system, c99 is a
script that runs gcc -std=c99 ..., which fits the bill.

GNU make uses CC=cc, which on a GNU system will be a link to GCC, which still
doesn't use the 1999 standard by default.

Even if there is a specific reason for the use of CC=cc instead of CC=c99 (and
if so, I'd be interested to hear why), POSIX specifies that by adding a dummy
target of .POSIX, make shall conform to the standard, so users that explicitly
add that target should see CC=c99.

Here is a shell script to create a C99 program and a makefile that requests
POSIX standards compliance. When make runs on the last line, you'll get errors
about GCC not running in c99 mode.

cat > ninetynine.c << "-----"
#include <stdio.h>

int main(){
    for (int i=0; i< 10; i++) printf("Hello.\n");
}
-----

cat > makefile << "-----"

CFLAGS=-g -Wall

#use the default build rule.
ninetynine:


#This rule requests standards-compliant behavior from make 
.POSIX:

-----

make




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?37069>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]