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

 
 

bug #37069: POSIX specifies CC=c99

Submitted by:  None
Submitted on:  Fri 10 Aug 2012 10:01:17 AM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: FixedPrivacy: Public
Assigned to: Paul D. Smith <psmith>Open/Closed: Closed
Component Version: 3.82Operating System: POSIX-Based
Fixed Release: 4.0Triage Status: Verified

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project AdministratorIn charge of this item.
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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 09 Sep 2012 07:20:35 PM UTCpsmithStatusNone=>Fixed
      Assigned toNone=>psmith
      Open/ClosedOpen=>Closed
      Fixed ReleaseNone=>4.0
      Triage StatusNone=>Verified

    Back to the top


    Powered by Savane 3.1-cleanup1