From: millert Date: Thu, 26 Oct 2023 17:33:35 +0000 (+0000) Subject: Make gnu99 the default for gcc 3.3.6 and 4.2.1, not gnu89. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3dd3831dabed72f6373e411e6fc364ad50a5d7a9;p=openbsd 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@ --- diff --git a/gnu/gcc/gcc/c-opts.c b/gnu/gcc/gcc/c-opts.c index 0494b9c2c37..37888a13cfa 100644 --- a/gnu/gcc/gcc/c-opts.c +++ b/gnu/gcc/gcc/c-opts.c @@ -236,6 +236,9 @@ c_common_init_options (unsigned int argc, const char **argv) if (c_language == clk_c) { + /* The default for C is gnu99. */ + set_std_c99 (false /* ISO */); + /* 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 ba218cdb559..1d43717df3e 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..b0a5f29af24 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 f1905f38ab1..e951b9d05b9 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.54 2017/06/10 16:00:27 schwarze Exp $ +.\" $OpenBSD: gcc-local.1,v 1.55 2023/10/26 17:33:35 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: June 10 2017 $ +.Dd $Mdocdate: October 26 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