aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-opts.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-opts.c')
-rw-r--r--gcc/c-opts.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index d2df860..8c5827a 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -893,6 +893,8 @@ c_common_handle_option (size_t scode, const char *arg, int value)
cpp_opts->warn_endif_labels = 1;
if (warn_pointer_sign == -1)
warn_pointer_sign = 1;
+ if (warn_overlength_strings == -1)
+ warn_overlength_strings = 1;
break;
case OPT_print_objc_runtime_info:
@@ -1018,6 +1020,12 @@ c_common_post_options (const char **pfilename)
if (warn_pointer_sign == -1)
warn_pointer_sign = 0;
+ /* -Woverlength-strings is off by default, but is enabled by -pedantic.
+ It is never enabled in C++, as the minimum limit is not normative
+ in that standard. */
+ if (warn_overlength_strings == -1 || c_dialect_cxx ())
+ warn_overlength_strings = 0;
+
/* Special format checking options don't work without -Wformat; warn if
they are used. */
if (!warn_format)