+2011-03-14 Tom Tromey <tromey@redhat.com>
+
+ * c-parser.c (c_parser_asm_string_literal): Clear
+ warn_overlength_strings.
+
2011-03-14 Tom Tromey <tromey@redhat.com>
* c-parser.c (disable_extension_diagnostics): Save
c_parser_asm_string_literal (c_parser *parser)
{
tree str;
+ int save_flag = warn_overlength_strings;
+ warn_overlength_strings = 0;
if (c_parser_next_token_is (parser, CPP_STRING))
{
str = c_parser_peek_token (parser)->value;
c_parser_error (parser, "expected string literal");
str = NULL_TREE;
}
+ warn_overlength_strings = save_flag;
return str;
}
+2011-03-14 Tom Tromey <tromey@redhat.com>
+
+ * gcc.dg/Woverlength-strings-pedantic-c90-asm.c: New file.
+ * gcc.dg/Woverlength-strings-pedantic-c89-asm.c: New file.
+ * gcc.dg/Woverlength-strings-pedantic-c99-asm.c: New file.
+
2011-03-14 Tom Tromey <tromey@redhat.com>
* gcc.dg/Woverlength-strings-pedantic-c89-ext.c: New file.
--- /dev/null
+/* -Woverlength-strings complains about string constants which are too long
+ for the C standard's "minimum maximum" limits. It is off by default,
+ but implied by -pedantic. */
+
+/* { dg-options "-std=c89 -pedantic" } */
+
+#define TEN " "
+#define HUN TEN TEN TEN TEN TEN TEN TEN TEN TEN TEN
+#define THO HUN HUN HUN HUN HUN HUN HUN HUN HUN HUN
+
+/* C89's minimum-maximum is 509. */
+__asm__ (HUN HUN HUN HUN HUN TEN);
+
+/* C99's minimum-maximum is 4095. */
+__asm__ (
+ THO THO THO THO /* 4000 */
+ TEN TEN TEN TEN TEN /* 4050 */
+ TEN TEN TEN TEN /* 4090 */
+ "123456");
+
+void
+f (void)
+{
+ /* C89's minimum-maximum is 509. */
+ __asm__ (HUN HUN HUN HUN HUN TEN);
+ __asm__ (HUN HUN HUN HUN HUN TEN : : );
+ __asm__ goto (HUN HUN HUN HUN HUN TEN : : : : label);
+
+ /* C99's minimum-maximum is 4095. */
+ __asm__ (
+ THO THO THO THO /* 4000 */
+ TEN TEN TEN TEN TEN /* 4050 */
+ TEN TEN TEN TEN /* 4090 */
+ "123456");
+ __asm__ (
+ THO THO THO THO /* 4000 */
+ TEN TEN TEN TEN TEN /* 4050 */
+ TEN TEN TEN TEN /* 4090 */
+ "123456" : : );
+ __asm__ goto (
+ THO THO THO THO /* 4000 */
+ TEN TEN TEN TEN TEN /* 4050 */
+ TEN TEN TEN TEN /* 4090 */
+ "123456" : : : : label);
+
+ label: ;
+}
--- /dev/null
+/* -Woverlength-strings complains about string constants which are too long
+ for the C standard's "minimum maximum" limits. It is off by default,
+ but implied by -pedantic. */
+
+/* { dg-options "-std=c90 -pedantic" } */
+
+#define TEN " "
+#define HUN TEN TEN TEN TEN TEN TEN TEN TEN TEN TEN
+#define THO HUN HUN HUN HUN HUN HUN HUN HUN HUN HUN
+
+/* C89's minimum-maximum is 509. */
+__asm__ (HUN HUN HUN HUN HUN TEN);
+
+/* C99's minimum-maximum is 4095. */
+__asm__ (
+ THO THO THO THO /* 4000 */
+ TEN TEN TEN TEN TEN /* 4050 */
+ TEN TEN TEN TEN /* 4090 */
+ "123456");
+
+void
+f (void)
+{
+ /* C89's minimum-maximum is 509. */
+ __asm__ (HUN HUN HUN HUN HUN TEN);
+ __asm__ (HUN HUN HUN HUN HUN TEN : :);
+ __asm__ goto (HUN HUN HUN HUN HUN TEN : : : : label);
+
+ /* C99's minimum-maximum is 4095. */
+ __asm__ (
+ THO THO THO THO /* 4000 */
+ TEN TEN TEN TEN TEN /* 4050 */
+ TEN TEN TEN TEN /* 4090 */
+ "123456");
+ __asm__ (
+ THO THO THO THO /* 4000 */
+ TEN TEN TEN TEN TEN /* 4050 */
+ TEN TEN TEN TEN /* 4090 */
+ "123456" : :);
+ __asm__ goto (
+ THO THO THO THO /* 4000 */
+ TEN TEN TEN TEN TEN /* 4050 */
+ TEN TEN TEN TEN /* 4090 */
+ "123456" : : : : label);
+
+ label: ;
+}
+
--- /dev/null
+/* -Woverlength-strings complains about string constants which are too long
+ for the C standard's "minimum maximum" limits. It is off by default,
+ but implied by -pedantic. */
+
+/* { dg-options "-std=c99 -pedantic" } */
+
+#define TEN " "
+#define HUN TEN TEN TEN TEN TEN TEN TEN TEN TEN TEN
+#define THO HUN HUN HUN HUN HUN HUN HUN HUN HUN HUN
+
+/* C89's minimum-maximum is 509. */
+__asm__ (HUN HUN HUN HUN HUN TEN);
+
+/* C99's minimum-maximum is 4095. */
+__asm__ (
+ THO THO THO THO /* 4000 */
+ TEN TEN TEN TEN TEN /* 4050 */
+ TEN TEN TEN TEN /* 4090 */
+ "123456");
+
+void
+f (void)
+{
+ /* C89's minimum-maximum is 509. */
+ __asm__ (HUN HUN HUN HUN HUN TEN);
+ __asm__ (HUN HUN HUN HUN HUN TEN : :);
+ __asm__ goto (HUN HUN HUN HUN HUN TEN : : : : label);
+
+ /* C99's minimum-maximum is 4095. */
+ __asm__ (
+ THO THO THO THO /* 4000 */
+ TEN TEN TEN TEN TEN /* 4050 */
+ TEN TEN TEN TEN /* 4090 */
+ "123456");
+ __asm__ (
+ THO THO THO THO /* 4000 */
+ TEN TEN TEN TEN TEN /* 4050 */
+ TEN TEN TEN TEN /* 4090 */
+ "123456" : :);
+ __asm__ goto (
+ THO THO THO THO /* 4000 */
+ TEN TEN TEN TEN TEN /* 4050 */
+ TEN TEN TEN TEN /* 4090 */
+ "123456" : : : : label);
+
+ label: ;
+}
+