Discussion:
make default CFLAGS vs. c99
ams-mXXj517/ (Alfred M. Szmidt)
2014-06-17 11:45:17 UTC
Permalink
Looking over the `make' section, it says that CFLAGS should be "-O",
but c99 accepts only "-O optlevel" (i.e. optlevel is not optional).
This leads to what I would think strange behaviour for example,

.POSIX:
foo: foo.o
$(CC) $(CFLAGS) $^ -o $@

results in the command,

c99 -O foo.o -o foo

which would be an invald invokation of c99.

There are two possible that I see, change CFLAGS in `make' to be "-O
1" (following FFLAGS), or change c99's -O behaviour to allow for an
optional optlevel (most C compilers already allow for this).

Best regards, Alfred.
Richard Hansen
2014-06-19 17:34:07 UTC
Permalink
Post by ams-mXXj517/ (Alfred M. Szmidt)
Looking over the `make' section, it says that CFLAGS should be "-O",
but c99 accepts only "-O optlevel" (i.e. optlevel is not optional).
Indeed; this is a defect. I filed bug #848 for this.
http://www.austingroupbugs.net/view.php?id=848
Post by ams-mXXj517/ (Alfred M. Szmidt)
There are two possible that I see, change CFLAGS in `make' to be "-O
1" (following FFLAGS), or change c99's -O behaviour to allow for an
optional optlevel (most C compilers already allow for this).
It is editorially easier to change the CFLAGS default than to change -O
to explicitly allow the omission of the optlevel option-argument.
Changing the default also makes CFLAGS consistent with FFLAGS, as you
stated. So my vote is to change the default to '-O 1' for bug #848.

Perhaps we could open a separate bug report to make the optlevel
option-argument optional, but this gets messy: Right now conforming
applications must specify '-O' and the level as separate arguments. XBD
12.1 says that optional option-arguments should not be separate
arguments. So, if the level is made optional, either all applications
would have to switch from separate arguments to a single argument or we
would have to make c99 an exception to the rules in XBD 12 and specify
how c99 determines whether the next argument is a level or a separate
option/operand.

Thank you for your bug report!

-Richard
Hal Finkel
2014-06-19 22:59:29 UTC
Permalink
----- Original Message -----
Sent: Thursday, June 19, 2014 12:34:07 PM
Subject: Re: make default CFLAGS vs. c99
Post by ams-mXXj517/ (Alfred M. Szmidt)
Looking over the `make' section, it says that CFLAGS should be "-O",
but c99 accepts only "-O optlevel" (i.e. optlevel is not optional).
Indeed; this is a defect. I filed bug #848 for this.
http://www.austingroupbugs.net/view.php?id=848
Post by ams-mXXj517/ (Alfred M. Szmidt)
There are two possible that I see, change CFLAGS in `make' to be "-O
1" (following FFLAGS), or change c99's -O behaviour to allow for an
optional optlevel (most C compilers already allow for this).
It is editorially easier to change the CFLAGS default than to change -O
to explicitly allow the omission of the optlevel option-argument.
Changing the default also makes CFLAGS consistent with FFLAGS, as you
stated. So my vote is to change the default to '-O 1' for bug #848.
Perhaps we could open a separate bug report to make the optlevel
option-argument optional, but this gets messy: Right now conforming
applications must specify '-O' and the level as separate arguments.
XBD
12.1 says that optional option-arguments should not be separate
arguments. So, if the level is made optional, either all
applications
would have to switch from separate arguments to a single argument or we
would have to make c99 an exception to the rules in XBD 12 and
specify
how c99 determines whether the next argument is a level or a separate
option/operand.
Out of curiosity, are there any current implementations that don't support -O, -O2, -O3 (etc.) [I think that IBM's implementation may not have a -O1, but does have the others]?

-Hal
Thank you for your bug report!
-Richard
--
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
Loading...