c-common.c (combine_strings): Emit a pedantic warning when a string length is greater than the minimum ANSI C...
* c-common.c (combine_strings): Emit a pedantic warning when a string length is greater than the minimum ANSI C is required to support. From-SVN: r34999
This commit is contained in:
parent
733dee92dc
commit
1326a48bac
@ -1,3 +1,9 @@
|
|||||||
|
2000-07-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||||
|
|
||||||
|
* c-common.c (combine_strings): Emit a pedantic warning when a
|
||||||
|
string length is greater than the minimum ANSI C is required
|
||||||
|
to support.
|
||||||
|
|
||||||
Wed Jul 12 13:24:30 2000 Jeffrey A Law (law@cygnus.com)
|
Wed Jul 12 13:24:30 2000 Jeffrey A Law (law@cygnus.com)
|
||||||
|
|
||||||
* pa/xm-pa64.h (NO_SYS_SIGLIST): Kill.
|
* pa/xm-pa64.h (NO_SYS_SIGLIST): Kill.
|
||||||
|
@ -294,6 +294,7 @@ combine_strings (strings)
|
|||||||
int wide_flag = 0;
|
int wide_flag = 0;
|
||||||
int wchar_bytes = TYPE_PRECISION (wchar_type_node) / BITS_PER_UNIT;
|
int wchar_bytes = TYPE_PRECISION (wchar_type_node) / BITS_PER_UNIT;
|
||||||
int nchars;
|
int nchars;
|
||||||
|
const int nchars_max = flag_isoc99 ? 4095 : 509;
|
||||||
|
|
||||||
if (TREE_CHAIN (strings))
|
if (TREE_CHAIN (strings))
|
||||||
{
|
{
|
||||||
@ -373,6 +374,10 @@ combine_strings (strings)
|
|||||||
/* Compute the number of elements, for the array type. */
|
/* Compute the number of elements, for the array type. */
|
||||||
nchars = wide_flag ? length / wchar_bytes : length;
|
nchars = wide_flag ? length / wchar_bytes : length;
|
||||||
|
|
||||||
|
if (pedantic && nchars > nchars_max)
|
||||||
|
pedwarn ("string length `%d' is greater than the minimum length `%d' ANSI C is required to support",
|
||||||
|
nchars, nchars_max);
|
||||||
|
|
||||||
/* Create the array type for the string constant.
|
/* Create the array type for the string constant.
|
||||||
-Wwrite-strings says make the string constant an array of const char
|
-Wwrite-strings says make the string constant an array of const char
|
||||||
so that copying it to a non-const pointer will get a warning.
|
so that copying it to a non-const pointer will get a warning.
|
||||||
|
Loading…
Reference in New Issue
Block a user