re PR fortran/19101 (missing & in character continuation not caught)
2006-03-14 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/19101 * gfortran.h: Add warn_ampersand. * invoke.texi: Add documentation for new option. * lang.opt: Add Wampersand. * options.c (gfc_init_options): Initialize warn_ampersand. (gfc_post_options): Set the warn if pedantic. (set_Wall): Set warn_ampersand. (gfc_handle_option: Add Wampersand for itself, -std=f95, and -std=f2003. * scanner.c (gfc_next_char_literal): Add test for missing '&' in continued character constant and give warning if missing. From-SVN: r112078
This commit is contained in:
parent
8a03ad9e34
commit
3fbab54926
@ -1,3 +1,16 @@
|
||||
2006-03-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||
|
||||
PR fortran/19101
|
||||
* gfortran.h: Add warn_ampersand.
|
||||
* invoke.texi: Add documentation for new option.
|
||||
* lang.opt: Add Wampersand.
|
||||
* options.c (gfc_init_options): Initialize warn_ampersand.
|
||||
(gfc_post_options): Set the warn if pedantic.
|
||||
(set_Wall): Set warn_ampersand.
|
||||
(gfc_handle_option: Add Wampersand for itself, -std=f95, and -std=f2003.
|
||||
* scanner.c (gfc_next_char_literal): Add test for missing '&' in
|
||||
continued character constant and give warning if missing.
|
||||
|
||||
2006-03-14 Steven G. Kargl <kargls@comcast.net>
|
||||
|
||||
PR 18537
|
||||
|
@ -1602,6 +1602,7 @@ typedef struct
|
||||
int verbose;
|
||||
|
||||
int warn_aliasing;
|
||||
int warn_ampersand;
|
||||
int warn_conversion;
|
||||
int warn_implicit_interface;
|
||||
int warn_line_truncation;
|
||||
|
@ -128,7 +128,7 @@ by type. Explanations are in the following sections.
|
||||
@xref{Warning Options,,Options to Request or Suppress Warnings}.
|
||||
@gccoptlist{
|
||||
-fsyntax-only -pedantic -pedantic-errors @gol
|
||||
-w -Wall -Waliasing -Wconversion -Wimplicit-interface @gol
|
||||
-w -Wall -Waliasing -Wampersand -Wconversion -Wimplicit-interface @gol
|
||||
-Wtabs -Wnonstd-intrinsics -Wsurprising -Wunderflow @gol
|
||||
-Wunused-labels -Wline-truncation -W}
|
||||
|
||||
@ -375,11 +375,11 @@ Inhibit all warning messages.
|
||||
@item -Wall
|
||||
@cindex all warnings
|
||||
@cindex warnings, all
|
||||
Enables commonly used warning options that which pertain to usage that
|
||||
we recommend avoiding and that we believe is easy to avoid.
|
||||
Enables commonly used warning options pertaining to usage that
|
||||
we recommend avoiding and that we believe are easy to avoid.
|
||||
This currently includes @option{-Wunused-labels}, @option{-Waliasing},
|
||||
@option{-Wsurprising}, @option{-Wnonstd-intrinsic}, @option{-Wno-tabs},
|
||||
and @option{-Wline-truncation}.
|
||||
@option{-Wampersand}, @option{-Wsurprising}, @option{-Wnonstd-intrinsic},
|
||||
@option{-Wno-tabs}, and @option{-Wline-truncation}.
|
||||
|
||||
|
||||
@cindex -Waliasing option
|
||||
@ -405,6 +405,17 @@ The following example will trigger the warning.
|
||||
@end smallexample
|
||||
|
||||
|
||||
@cindex -Wampersand option
|
||||
@cindex options, -Wampersand
|
||||
@item -Wampersand
|
||||
@cindex ampersand
|
||||
Warn about missing ampersand in continued character constants. The warning is
|
||||
given with @option{-Wampersand}, @option{-pedantic}, @option{-std=f95}, and
|
||||
@option{-std=f2003}. Note: With no ampersand given in a continued character
|
||||
constant, gfortran assumes continuation at the first non-comment,
|
||||
non-whitespace character after the ampersand that initiated the continuation.
|
||||
|
||||
|
||||
@cindex -Wconversion option
|
||||
@cindex options, -Wconversion
|
||||
@item -Wconversion
|
||||
@ -445,6 +456,7 @@ lower value is greater than its upper value.
|
||||
A LOGICAL SELECT construct has three CASE statements.
|
||||
@end itemize
|
||||
|
||||
|
||||
@cindex -Wtabs
|
||||
@cindex options, -Wtabs
|
||||
@item -Wtabs
|
||||
@ -454,6 +466,7 @@ of the Fortran Character Set. @option{-Wno-tabs} will cause a warning
|
||||
to be issued if a tab is encountered. Note, @option{-Wno-tabs} is active
|
||||
for @option{-pedantic}, @option{-std=f95}, and @option{-Wall}.
|
||||
|
||||
|
||||
@cindex -Wunderflow
|
||||
@cindex options, -Wunderflow
|
||||
@item -Wunderflow
|
||||
|
@ -41,6 +41,10 @@ Waliasing
|
||||
Fortran
|
||||
Warn about possible aliasing of dummy arguments
|
||||
|
||||
Wampersand
|
||||
Fortran
|
||||
Warn about missing ampersand in continued character constants
|
||||
|
||||
Wconversion
|
||||
Fortran
|
||||
Warn about implicit conversion
|
||||
|
@ -52,6 +52,7 @@ gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED,
|
||||
gfc_option.verbose = 0;
|
||||
|
||||
gfc_option.warn_aliasing = 0;
|
||||
gfc_option.warn_ampersand = 0;
|
||||
gfc_option.warn_conversion = 0;
|
||||
gfc_option.warn_implicit_interface = 0;
|
||||
gfc_option.warn_line_truncation = 0;
|
||||
@ -271,6 +272,9 @@ gfc_post_options (const char **pfilename)
|
||||
/* Implement -fno-automatic as -fmax-stack-var-size=0. */
|
||||
if (!gfc_option.flag_automatic)
|
||||
gfc_option.flag_max_stack_var_size = 0;
|
||||
|
||||
if (pedantic)
|
||||
gfc_option.warn_ampersand = 1;
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -283,6 +287,7 @@ set_Wall (void)
|
||||
{
|
||||
|
||||
gfc_option.warn_aliasing = 1;
|
||||
gfc_option.warn_ampersand = 1;
|
||||
gfc_option.warn_line_truncation = 1;
|
||||
gfc_option.warn_nonstd_intrinsics = 1;
|
||||
gfc_option.warn_surprising = 1;
|
||||
@ -385,6 +390,10 @@ gfc_handle_option (size_t scode, const char *arg, int value)
|
||||
gfc_option.warn_aliasing = value;
|
||||
break;
|
||||
|
||||
case OPT_Wampersand:
|
||||
gfc_option.warn_ampersand = value;
|
||||
break;
|
||||
|
||||
case OPT_Wconversion:
|
||||
gfc_option.warn_conversion = value;
|
||||
break;
|
||||
@ -553,6 +562,7 @@ gfc_handle_option (size_t scode, const char *arg, int value)
|
||||
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95 | GFC_STD_F77;
|
||||
gfc_option.warn_std = GFC_STD_F95_OBS;
|
||||
gfc_option.max_identifier_length = 31;
|
||||
gfc_option.warn_ampersand = 1;
|
||||
gfc_option.warn_tabs = 0;
|
||||
break;
|
||||
|
||||
@ -561,6 +571,7 @@ gfc_handle_option (size_t scode, const char *arg, int value)
|
||||
| GFC_STD_F2003 | GFC_STD_F95;
|
||||
gfc_option.warn_std = GFC_STD_F95_OBS;
|
||||
gfc_option.max_identifier_length = 63;
|
||||
gfc_option.warn_ampersand = 1;
|
||||
break;
|
||||
|
||||
case OPT_std_gnu:
|
||||
|
@ -680,7 +680,12 @@ restart:
|
||||
}
|
||||
|
||||
if (c != '&')
|
||||
gfc_current_locus = old_loc;
|
||||
{
|
||||
if (in_string && gfc_option.warn_ampersand)
|
||||
gfc_warning ("Missing '&' in continued character constant at %C");
|
||||
|
||||
gfc_current_locus.nextc--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -978,7 +983,7 @@ load_line (FILE * input, char **pbuf, int *pbuflen)
|
||||
if (i >= buflen)
|
||||
{
|
||||
/* Reallocate line buffer to double size to hold the
|
||||
overlong line. */
|
||||
overlong line. */
|
||||
buflen = buflen * 2;
|
||||
*pbuf = xrealloc (*pbuf, buflen + 1);
|
||||
buffer = (*pbuf)+i;
|
||||
|
Loading…
Reference in New Issue
Block a user