* [C++ Patch] PR 60211 (take 2)
@ 2015-02-13 16:05 Paolo Carlini
2015-02-13 16:14 ` Jason Merrill
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Carlini @ 2015-02-13 16:05 UTC (permalink / raw)
To: gcc-patches; +Cc: Jason Merrill
[-- Attachment #1: Type: text/plain, Size: 155 bytes --]
Hi,
this a second take, fixing the problem the way preferred by Jason in the
audit trail. Tested x86_64-linux.
Thanks,
Paolo.
////////////////////////
[-- Attachment #2: CL_60211_2 --]
[-- Type: text/plain, Size: 306 bytes --]
/cp
2015-02-13 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/60211
* parser.c (cp_parser_pragma): Diagnose PRAGMA_IVDEP at
pragma_external context.
/testsuite
2015-02-13 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/60211
* g++.dg/parse/ivdep-2.C: New.
* g++.dg/parse/ivdep-3.C: Likewise.
[-- Attachment #3: patch_60211_2 --]
[-- Type: text/plain, Size: 1400 bytes --]
Index: cp/parser.c
===================================================================
--- cp/parser.c (revision 220684)
+++ cp/parser.c (working copy)
@@ -33060,6 +33060,12 @@ cp_parser_pragma (cp_parser *parser, enum pragma_c
case PRAGMA_IVDEP:
{
+ if (context == pragma_external)
+ {
+ error_at (pragma_tok->location,
+ "%<#pragma GCC ivdep%> must be inside a function");
+ break;
+ }
cp_parser_skip_to_pragma_eol (parser, pragma_tok);
cp_token *tok;
tok = cp_lexer_peek_token (the_parser->lexer);
Index: testsuite/g++.dg/parse/ivdep-2.C
===================================================================
--- testsuite/g++.dg/parse/ivdep-2.C (revision 0)
+++ testsuite/g++.dg/parse/ivdep-2.C (working copy)
@@ -0,0 +1,9 @@
+// PR c++/60211
+
+void foo()
+{}
+ int i;
+#pragma GCC ivdep // { dg-error "must be inside a function" }
+ for (i = 0; i < 2; ++i) // { dg-error "expected|type" }
+ ;
+} // { dg-error "expected" }
Index: testsuite/g++.dg/parse/ivdep-3.C
===================================================================
--- testsuite/g++.dg/parse/ivdep-3.C (revision 0)
+++ testsuite/g++.dg/parse/ivdep-3.C (working copy)
@@ -0,0 +1,8 @@
+// PR c++/60211
+
+void foo()
+{}
+#pragma GCC ivdep // { dg-error "must be inside a function" }
+ for (int i = 0; i < 2; ++i) // { dg-error "expected|type" }
+ ;
+} // { dg-error "expected" }
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [C++ Patch] PR 60211 (take 2)
2015-02-13 16:05 [C++ Patch] PR 60211 (take 2) Paolo Carlini
@ 2015-02-13 16:14 ` Jason Merrill
0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2015-02-13 16:14 UTC (permalink / raw)
To: Paolo Carlini, gcc-patches
OK.
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-13 16:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-13 16:05 [C++ Patch] PR 60211 (take 2) Paolo Carlini
2015-02-13 16:14 ` Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).