public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: gcc-patches@gcc.gnu.org
Subject: [committed] Fix declare-simd-1.C testcase failure
Date: Thu, 23 Nov 2017 20:36:00 -0000	[thread overview]
Message-ID: <20171123202632.GR14653@tucnak> (raw)

Hi!

The -Wreturn-type warning on declare-simd-1.C shows we were actually
misparsing it with -fopenmp, e.g.
  if (1)
    #pragma omp declare simd
    extern float foo (float);
  n++;
was actually parsed as
  if (1)
    {
      #pragma omp declare simd
      extern float foo (float);
      n++;
    }
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
committed to trunk.

2017-11-23  Jakub Jelinek  <jakub@redhat.com>

	* parser.c (cp_parser_omp_declare): Change return type to bool from
	void, return true for declare simd.
	(cp_parser_pragma): Return cp_parser_omp_declare returned value
	rather than always false.

--- gcc/cp/parser.c.jj	2017-11-23 15:31:44.000000000 +0100
+++ gcc/cp/parser.c	2017-11-23 17:29:54.925145608 +0100
@@ -37904,7 +37904,7 @@ cp_parser_omp_declare_reduction (cp_pars
       initializer-clause[opt] new-line
    #pragma omp declare target new-line  */
 
-static void
+static bool
 cp_parser_omp_declare (cp_parser *parser, cp_token *pragma_tok,
 		       enum pragma_context context)
 {
@@ -37918,7 +37918,7 @@ cp_parser_omp_declare (cp_parser *parser
 	  cp_lexer_consume_token (parser->lexer);
 	  cp_parser_omp_declare_simd (parser, pragma_tok,
 				      context);
-	  return;
+	  return true;
 	}
       cp_ensure_no_omp_declare_simd (parser);
       if (strcmp (p, "reduction") == 0)
@@ -37926,23 +37926,24 @@ cp_parser_omp_declare (cp_parser *parser
 	  cp_lexer_consume_token (parser->lexer);
 	  cp_parser_omp_declare_reduction (parser, pragma_tok,
 					   context);
-	  return;
+	  return false;
 	}
       if (!flag_openmp)  /* flag_openmp_simd  */
 	{
 	  cp_parser_skip_to_pragma_eol (parser, pragma_tok);
-	  return;
+	  return false;
 	}
       if (strcmp (p, "target") == 0)
 	{
 	  cp_lexer_consume_token (parser->lexer);
 	  cp_parser_omp_declare_target (parser, pragma_tok);
-	  return;
+	  return false;
 	}
     }
   cp_parser_error (parser, "expected %<simd%> or %<reduction%> "
 			   "or %<target%>");
   cp_parser_require_pragma_eol (parser, pragma_tok);
+  return false;
 }
 
 /* OpenMP 4.5:
@@ -38861,8 +38862,7 @@ cp_parser_pragma (cp_parser *parser, enu
       return false;
 
     case PRAGMA_OMP_DECLARE:
-      cp_parser_omp_declare (parser, pragma_tok, context);
-      return false;
+      return cp_parser_omp_declare (parser, pragma_tok, context);
 
     case PRAGMA_OACC_DECLARE:
       cp_parser_oacc_declare (parser, pragma_tok);

	Jakub

                 reply	other threads:[~2017-11-23 20:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171123202632.GR14653@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).