aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/options.cc
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2023-11-17 13:34:55 +0100
committerTobias Burnus <tobias@codesourcery.com>2023-11-17 13:34:55 +0100
commitb9eba3baf54b4fc25c3006768bb945058622658b (patch)
tree0c48ceb04bf97204b1701352be80059cc4c1f831 /gcc/fortran/options.cc
parent68221c54a9752dbf131c231413edfd21046f8dad (diff)
downloadgcc-b9eba3baf54b4fc25c3006768bb945058622658b.zip
gcc-b9eba3baf54b4fc25c3006768bb945058622658b.tar.gz
gcc-b9eba3baf54b4fc25c3006768bb945058622658b.tar.bz2
Fortran: Accept -std=f2023, update line-length for Fortran 2023
This patch accepts -std=f2023, uses it by default and bumps for the free-source form the line length to 10,000 and the statement length alias number of continuation lines to unlimited. gcc/fortran/ChangeLog: * gfortran.texi (_gfortran_set_options): Document GFC_STD_F2023. * invoke.texi (std,pedantic,Wampersand,Wtabs): Add -std=2023. * lang.opt (std=f2023): Add. * libgfortran.h (GFC_STD_F2023, GFC_STD_OPT_F23): Add. * options.cc (set_default_std_flags): Add GFC_STD_F2023. (gfc_init_options): Set max_continue_free to 1,000,000. (gfc_post_options): Set flag_free_line_length if unset. (gfc_handle_option): Add OPT_std_f2023, set max_continue_free = 255 for -std=f2003, f2008 and f2018. gcc/testsuite/ChangeLog: * gfortran.dg/goacc/warn_truncated.f90: Add -std=f2018 option. * gfortran.dg/gomp/warn_truncated.f90: Likewise. * gfortran.dg/line_length_10.f90: Likewise. * gfortran.dg/line_length_11.f90: Likewise. * gfortran.dg/line_length_2.f90: Likewise. * gfortran.dg/line_length_5.f90: Likewise. * gfortran.dg/line_length_6.f90: Likewise. * gfortran.dg/line_length_7.f90: Likewise. * gfortran.dg/line_length_8.f90: Likewise. * gfortran.dg/line_length_9.f90: Likewise. * gfortran.dg/continuation_17.f90: New test. * gfortran.dg/continuation_18.f90: New test. * gfortran.dg/continuation_19.f: New test. * gfortran.dg/line_length_12.f90: New test. * gfortran.dg/line_length_13.f90: New test.
Diffstat (limited to 'gcc/fortran/options.cc')
-rw-r--r--gcc/fortran/options.cc28
1 files changed, 25 insertions, 3 deletions
diff --git a/gcc/fortran/options.cc b/gcc/fortran/options.cc
index cfb1957..b788521 100644
--- a/gcc/fortran/options.cc
+++ b/gcc/fortran/options.cc
@@ -57,7 +57,7 @@ set_default_std_flags (void)
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
| GFC_STD_F2003 | GFC_STD_F2008 | GFC_STD_F95 | GFC_STD_F77
| GFC_STD_F2008_OBS | GFC_STD_GNU | GFC_STD_LEGACY
- | GFC_STD_F2018 | GFC_STD_F2018_DEL | GFC_STD_F2018_OBS;
+ | GFC_STD_F2018 | GFC_STD_F2018_DEL | GFC_STD_F2018_OBS | GFC_STD_F2023;
gfc_option.warn_std = GFC_STD_F2018_DEL | GFC_STD_F95_DEL | GFC_STD_LEGACY;
}
@@ -143,8 +143,11 @@ gfc_init_options (unsigned int decoded_options_count,
gfc_source_file = NULL;
gfc_option.module_dir = NULL;
gfc_option.source_form = FORM_UNKNOWN;
- gfc_option.max_continue_fixed = 255;
- gfc_option.max_continue_free = 255;
+ /* The following is not quite right as Fortran since 2023 has: "A statement
+ shall not have more than one million characters." This can already be
+ reached by 'just' 100 lines with 10,000 characters each. */
+ gfc_option.max_continue_fixed = 1000000;
+ gfc_option.max_continue_free = 1000000;
gfc_option.max_identifier_length = GFC_MAX_SYMBOL_LEN;
gfc_option.max_errors = 25;
@@ -266,6 +269,10 @@ gfc_post_options (const char **pfilename)
cpp_warn_missing_include_dirs, 1);
gfc_check_include_dirs (verbose_missing_dir_warn);
+ SET_OPTION_IF_UNSET (&global_options, &global_options_set,
+ flag_free_line_length,
+ (gfc_option.allow_std & GFC_STD_F2023) ? 10000 : 132);
+
/* Finalize DEC flags. */
post_dec_flags (flag_dec);
@@ -769,6 +776,8 @@ gfc_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
case OPT_std_f2003:
gfc_option.allow_std = GFC_STD_OPT_F03;
gfc_option.warn_std = GFC_STD_F95_OBS;
+ gfc_option.max_continue_fixed = 255;
+ gfc_option.max_continue_free = 255;
gfc_option.max_identifier_length = 63;
warn_ampersand = 1;
warn_tabs = 1;
@@ -777,6 +786,8 @@ gfc_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
case OPT_std_f2008:
gfc_option.allow_std = GFC_STD_OPT_F08;
gfc_option.warn_std = GFC_STD_F95_OBS | GFC_STD_F2008_OBS;
+ gfc_option.max_continue_free = 255;
+ gfc_option.max_continue_fixed = 255;
gfc_option.max_identifier_length = 63;
warn_ampersand = 1;
warn_tabs = 1;
@@ -787,6 +798,17 @@ gfc_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
gfc_option.allow_std = GFC_STD_OPT_F18;
gfc_option.warn_std = GFC_STD_F95_OBS | GFC_STD_F2008_OBS
| GFC_STD_F2018_OBS;
+ gfc_option.max_continue_free = 255;
+ gfc_option.max_continue_fixed = 255;
+ gfc_option.max_identifier_length = 63;
+ warn_ampersand = 1;
+ warn_tabs = 1;
+ break;
+
+ case OPT_std_f2023:
+ gfc_option.allow_std = GFC_STD_OPT_F23;
+ gfc_option.warn_std = GFC_STD_F95_OBS | GFC_STD_F2008_OBS
+ | GFC_STD_F2018_OBS;
gfc_option.max_identifier_length = 63;
warn_ampersand = 1;
warn_tabs = 1;