summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2023-10-29 23:31:17 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2023-10-29 23:31:17 +0000
commit48239f4e1de5c697d4836329fd6ef0f732b26fd4 (patch)
treef2ea11317ea942014a348d939ae91bb79ebd29da
parent273e62b26726721c9720313b282bbe42937a7abc (diff)
Make gnu99 the default for gcc 3.3.6 and 4.2.1, not gnu89.
While these versions of gcc don't have full C99 support, it is better than defaulting to C89 when building modern software. OK deraadt@
-rw-r--r--gnu/gcc/gcc/c-opts.c5
-rw-r--r--gnu/gcc/gcc/doc/cppopts.texi4
-rw-r--r--gnu/gcc/gcc/doc/gcc.110
-rw-r--r--gnu/gcc/gcc/doc/gcc.info11
-rw-r--r--gnu/gcc/gcc/doc/invoke.texi6
-rw-r--r--gnu/usr.bin/gcc/gcc/c-opts.c9
-rw-r--r--gnu/usr.bin/gcc/gcc/doc/cppopts.texi4
-rw-r--r--gnu/usr.bin/gcc/gcc/doc/invoke.texi6
-rw-r--r--share/man/man1/gcc-local.115
9 files changed, 45 insertions, 25 deletions
diff --git a/gnu/gcc/gcc/c-opts.c b/gnu/gcc/gcc/c-opts.c
index 0494b9c2c37..269857b7678 100644
--- a/gnu/gcc/gcc/c-opts.c
+++ b/gnu/gcc/gcc/c-opts.c
@@ -236,6 +236,11 @@ c_common_init_options (unsigned int argc, const char **argv)
if (c_language == clk_c)
{
+ /* The default for C is gnu99, without warnings for non-static
+ inline functions. */
+ set_std_c99 (false /* ISO */);
+ flag_gnu89_inline = 1;
+
/* If preprocessing assembly language, accept any of the C-family
front end options since the driver may pass them through. */
for (i = 1; i < argc; i++)
diff --git a/gnu/gcc/gcc/doc/cppopts.texi b/gnu/gcc/gcc/doc/cppopts.texi
index c1d732b44c0..0d1b44410d9 100644
--- a/gnu/gcc/gcc/doc/cppopts.texi
+++ b/gnu/gcc/gcc/doc/cppopts.texi
@@ -392,11 +392,11 @@ The revised ISO C standard, published in December 1999. Before
publication, this was known as C9X@.
@item gnu89
-The 1990 C standard plus GNU extensions. This is the default.
+The 1990 C standard plus GNU extensions.
@item gnu99
@itemx gnu9x
-The 1999 C standard plus GNU extensions.
+The 1999 C standard plus GNU extensions. This is the default.
@item c++98
The 1998 ISO C++ standard plus amendments.
diff --git a/gnu/gcc/gcc/doc/gcc.1 b/gnu/gcc/gcc/doc/gcc.1
index 69921c640f3..467ac428ba2 100644
--- a/gnu/gcc/gcc/doc/gcc.1
+++ b/gnu/gcc/gcc/doc/gcc.1
@@ -1163,15 +1163,15 @@ provided; possible values are
names \fBc9x\fR and \fBiso9899:199x\fR are deprecated.
.IP "\fBgnu89\fR" 4
.IX Item "gnu89"
-Default, \s-1ISO\s0 C90 plus \s-1GNU\s0 extensions (including some C99 features).
+\&\s-1ISO\s0 C90 plus \s-1GNU\s0 extensions (including some C99 features).
.IP "\fBgnu99\fR" 4
.IX Item "gnu99"
.PD 0
.IP "\fBgnu9x\fR" 4
.IX Item "gnu9x"
.PD
-\&\s-1ISO\s0 C99 plus \s-1GNU\s0 extensions. When \s-1ISO\s0 C99 is fully implemented in \s-1GCC\s0,
-this will become the default. The name \fBgnu9x\fR is deprecated.
+Default, \s-1ISO\s0 C99 plus \s-1GNU\s0 extensions.
+The name \fBgnu9x\fR is deprecated.
.IP "\fBc++98\fR" 4
.IX Item "c++98"
The 1998 \s-1ISO\s0 \*(C+ standard plus amendments.
@@ -6364,7 +6364,7 @@ publication, this was known as C9X.
.ie n .IP """gnu89""" 4
.el .IP "\f(CWgnu89\fR" 4
.IX Item "gnu89"
-The 1990 C standard plus \s-1GNU\s0 extensions. This is the default.
+The 1990 C standard plus \s-1GNU\s0 extensions.
.ie n .IP """gnu99""" 4
.el .IP "\f(CWgnu99\fR" 4
.IX Item "gnu99"
@@ -6373,7 +6373,7 @@ The 1990 C standard plus \s-1GNU\s0 extensions. This is the default.
.el .IP "\f(CWgnu9x\fR" 4
.IX Item "gnu9x"
.PD
-The 1999 C standard plus \s-1GNU\s0 extensions.
+The 1999 C standard plus \s-1GNU\s0 extensions. This is the default.
.ie n .IP """c++98""" 4
.el .IP "\f(CWc++98\fR" 4
.IX Item "c++98"
diff --git a/gnu/gcc/gcc/doc/gcc.info b/gnu/gcc/gcc/doc/gcc.info
index 5db6aeafb6c..65963274a66 100644
--- a/gnu/gcc/gcc/doc/gcc.info
+++ b/gnu/gcc/gcc/doc/gcc.info
@@ -1350,14 +1350,13 @@ accepts:
deprecated.
`gnu89'
- Default, ISO C90 plus GNU extensions (including some C99
+ ISO C90 plus GNU extensions (including some C99
features).
`gnu99'
`gnu9x'
- ISO C99 plus GNU extensions. When ISO C99 is fully
- implemented in GCC, this will become the default. The name
- `gnu9x' is deprecated.
+ Default, ISO C99 plus GNU extensions.
+ The name `gnu9x' is deprecated.
`c++98'
The 1998 ISO C++ standard plus amendments.
@@ -6430,11 +6429,11 @@ cause the preprocessor output to be unsuitable for actual compilation.
Before publication, this was known as C9X.
`gnu89'
- The 1990 C standard plus GNU extensions. This is the default.
+ The 1990 C standard plus GNU extensions.
`gnu99'
`gnu9x'
- The 1999 C standard plus GNU extensions.
+ The 1999 C standard plus GNU extensions. This is the default.
`c++98'
The 1998 ISO C++ standard plus amendments.
diff --git a/gnu/gcc/gcc/doc/invoke.texi b/gnu/gcc/gcc/doc/invoke.texi
index aa2eeb8ff43..ea12878ce5c 100644
--- a/gnu/gcc/gcc/doc/invoke.texi
+++ b/gnu/gcc/gcc/doc/invoke.texi
@@ -1188,12 +1188,12 @@ ISO C99. Note that this standard is not yet fully supported; see
names @samp{c9x} and @samp{iso9899:199x} are deprecated.
@item gnu89
-Default, ISO C90 plus GNU extensions (including some C99 features).
+ISO C90 plus GNU extensions (including some C99 features).
@item gnu99
@itemx gnu9x
-ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC,
-this will become the default. The name @samp{gnu9x} is deprecated.
+Defaults, ISO C99 plus GNU extensions.
+The name @samp{gnu9x} is deprecated.
@item c++98
The 1998 ISO C++ standard plus amendments.
diff --git a/gnu/usr.bin/gcc/gcc/c-opts.c b/gnu/usr.bin/gcc/gcc/c-opts.c
index d20dec4cf5c..8e8d9ced5eb 100644
--- a/gnu/usr.bin/gcc/gcc/c-opts.c
+++ b/gnu/usr.bin/gcc/gcc/c-opts.c
@@ -509,7 +509,7 @@ c_common_init_options (lang)
#endif
c_language = lang;
- parse_in = cpp_create_reader (lang == clk_c ? CLK_GNUC89 : CLK_GNUCXX);
+ parse_in = cpp_create_reader (lang == clk_c ? CLK_GNUC99 : CLK_GNUCXX);
cpp_opts = cpp_get_options (parse_in);
if (flag_objc)
cpp_opts->objc = 1;
@@ -517,7 +517,12 @@ c_common_init_options (lang)
flag_const_strings = (lang == clk_cplusplus);
warn_pointer_arith = (lang == clk_cplusplus);
if (lang == clk_c)
- warn_sign_compare = -1;
+ {
+ /* The default for C is gnu99. */
+ set_std_c99 (false /* ISO */);
+
+ warn_sign_compare = -1;
+ }
}
static char *bad_option;
diff --git a/gnu/usr.bin/gcc/gcc/doc/cppopts.texi b/gnu/usr.bin/gcc/gcc/doc/cppopts.texi
index 1cc688a4730..4a1d7d0d215 100644
--- a/gnu/usr.bin/gcc/gcc/doc/cppopts.texi
+++ b/gnu/usr.bin/gcc/gcc/doc/cppopts.texi
@@ -351,11 +351,11 @@ The revised ISO C standard, published in December 1999. Before
publication, this was known as C9X@.
@item gnu89
-The 1990 C standard plus GNU extensions. This is the default.
+The 1990 C standard plus GNU extensions.
@item gnu99
@itemx gnu9x
-The 1999 C standard plus GNU extensions.
+The 1999 C standard plus GNU extensions. This is the default.
@item c++98
The 1998 ISO C++ standard plus amendments.
diff --git a/gnu/usr.bin/gcc/gcc/doc/invoke.texi b/gnu/usr.bin/gcc/gcc/doc/invoke.texi
index b2b61f6758a..582612452e1 100644
--- a/gnu/usr.bin/gcc/gcc/doc/invoke.texi
+++ b/gnu/usr.bin/gcc/gcc/doc/invoke.texi
@@ -1015,12 +1015,12 @@ ISO C99. Note that this standard is not yet fully supported; see
names @samp{c9x} and @samp{iso9899:199x} are deprecated.
@item gnu89
-Default, ISO C90 plus GNU extensions (including some C99 features).
+ISO C90 plus GNU extensions (including some C99 features).
@item gnu99
@itemx gnu9x
-ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC,
-this will become the default. The name @samp{gnu9x} is deprecated.
+Default, ISO C99 plus GNU extensions.
+The name @samp{gnu9x} is deprecated.
@item c++98
The 1998 ISO C++ standard plus amendments.
diff --git a/share/man/man1/gcc-local.1 b/share/man/man1/gcc-local.1
index 24584c0117b..928c01d1155 100644
--- a/share/man/man1/gcc-local.1
+++ b/share/man/man1/gcc-local.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: gcc-local.1,v 1.56 2023/10/28 00:25:19 millert Exp $
+.\" $OpenBSD: gcc-local.1,v 1.57 2023/10/29 23:31:16 millert Exp $
.\"
.\" Copyright (c) 2002 Marc Espie
.\" Copyright (c) 2003 Anil Madhavapeddy
@@ -25,7 +25,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: October 28 2023 $
+.Dd $Mdocdate: October 29 2023 $
.Dt GCC-LOCAL 1
.Os
.Sh NAME
@@ -42,6 +42,17 @@ the software comes with specific modifications for
.Ox :
.Bl -dash
.It
+For the C programming language,
+.Nm gcc
+defaults to the
+.Em gnu99
+standard,
+not
+.Em gnu89 .
+The
+.Fl std
+option can be used to select a different language standard.
+.It
.Nm gcc
does not search under
.Pa /usr/local