bugmake - Bugs: bug #37069, POSIX specifies CC=c99

 
 

bug #37069: POSIX specifies CC=c99

Submitter:  None
Submitted:  Fri 10 Aug 2012 10:01:17 AM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  3.82 Operating System:  POSIX-Based
Fixed Release:  4.0 Triage Status:  Verified
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 09 Sep 2012 07:20:35 PM UTC, comment #1: 

OK I added settings for all the standard POSIX macros as specified in IEEE Std 1003.1-2008 when the .POSIX: special target is seen.

Paul D. Smith <psmith>
Group administrator
Fri 10 Aug 2012 10:01:17 AM UTC, original submission:  

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

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-09-09 psmith StatusNone Fixed
        Assigned toNone psmith
        Open/ClosedOpen Closed
        Fixed ReleaseNone 4.0
        Triage StatusNone Verified

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code