aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/parse.h
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-10-26 10:50:40 -0700
committerIan Lance Taylor <iant@golang.org>2021-10-26 16:11:26 -0700
commitab10383aaebf2feebd2b6d68247f2520eff48f79 (patch)
treeb7296e54620d4fbe3fef6d4ebad91a9bbe7065ff /gcc/go/gofrontend/parse.h
parent1ff4dbddcf74203a1e16316b18e12f9e1b5085f0 (diff)
downloadgcc-ab10383aaebf2feebd2b6d68247f2520eff48f79.zip
gcc-ab10383aaebf2feebd2b6d68247f2520eff48f79.tar.gz
gcc-ab10383aaebf2feebd2b6d68247f2520eff48f79.tar.bz2
compiler: permit compiler directives in parenthesized groups
The original compiler directive support was only for //line at the start of a line and for //go: comments before function declarations. When support was added for //go:notinheap for types and //go:embed for variables the code did not adapt to permit spaces before the comment or to permit the comments in var() or type() groups. This change corrects those omissions. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/358699
Diffstat (limited to 'gcc/go/gofrontend/parse.h')
-rw-r--r--gcc/go/gofrontend/parse.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/gcc/go/gofrontend/parse.h b/gcc/go/gofrontend/parse.h
index 2c3c505..6e300ef 100644
--- a/gcc/go/gofrontend/parse.h
+++ b/gcc/go/gofrontend/parse.h
@@ -181,15 +181,14 @@ class Parse
void method_spec(Typed_identifier_list*);
void declaration();
bool declaration_may_start_here();
- void decl(void (Parse::*)(unsigned int, std::vector<std::string>*),
- unsigned int pragmas, std::vector<std::string>* embeds);
- void list(void (Parse::*)(unsigned int, std::vector<std::string>*), bool);
+ void decl(void (Parse::*)());
+ void list(void (Parse::*)(), bool);
void const_decl();
void const_spec(int, Type**, Expression_list**);
- void type_decl(unsigned int pragmas);
- void type_spec(unsigned int pragmas, std::vector<std::string>*);
- void var_decl(std::vector<std::string>* embeds);
- void var_spec(unsigned int pragmas, std::vector<std::string>*);
+ void type_decl();
+ void type_spec();
+ void var_decl();
+ void var_spec();
void init_vars(const Typed_identifier_list*, Type*, Expression_list*,
bool is_coloneq, std::vector<std::string>*, Location);
bool init_vars_from_call(const Typed_identifier_list*, Type*, Expression*,
@@ -210,7 +209,7 @@ class Parse
void simple_var_decl_or_assignment(const std::string&, Location,
bool may_be_composite_lit,
Range_clause*, Type_switch*);
- void function_decl(unsigned int pragmas);
+ void function_decl();
Typed_identifier* receiver();
Expression* operand(bool may_be_sink, bool *is_parenthesized);
Expression* enclosing_var_reference(Named_object*, Named_object*,
@@ -278,7 +277,10 @@ class Parse
void goto_stat();
void package_clause();
void import_decl();
- void import_spec(unsigned int pragmas, std::vector<std::string>*);
+ void import_spec();
+
+ // Check for unused compiler directives.
+ void check_directives();
// Skip past an error looking for a semicolon or OP. Return true if
// all is well, false if we found EOF.