summaryrefslogtreecommitdiff
path: root/ext/ripper
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-05-04 12:10:04 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-05-04 12:28:24 +0900
commitb7e1eda932c74196d58e6b63644200b764b5453e (patch)
tree6300f14588efa6ec5884d99bebf10cab4d679d25 /ext/ripper
parent39bd1244b49aa1fcf93d3163bfd97d94b109f2ee (diff)
Suppress warnings by gcc 10.1.0-RC-20200430
* Folding results should not be empty. If `OnigCodePointCount(to->n)` were 0, `for` loop using `fn` wouldn't execute and `ncs` elements are not initialized. ``` enc/unicode.c:557:21: warning: 'ncs[0]' may be used uninitialized in this function [-Wmaybe-uninitialized] 557 | for (i = 0; i < ncs[0]; i++) { | ~~~^~~ ``` * Cast to `enum yytokentype` Additional enums for scanner events by ripper are not included in `yytokentype`. ``` ripper.y:7274:28: warning: implicit conversion from 'enum <anonymous>' to 'enum yytokentype' [-Wenum-conversion] ```
Diffstat (limited to 'ext/ripper')
-rw-r--r--ext/ripper/eventids2.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/ripper/eventids2.c b/ext/ripper/eventids2.c
index cdac2081e64..ac38663f2d2 100644
--- a/ext/ripper/eventids2.c
+++ b/ext/ripper/eventids2.c
@@ -1,12 +1,20 @@
enum {
tIGNORED_NL = tLAST_TOKEN + 1,
+# define tIGNORED_NL ((enum yytokentype)tIGNORED_NL)
tCOMMENT,
+# define tCOMMENT ((enum yytokentype)tCOMMENT)
tEMBDOC_BEG,
+# define tEMBDOC_BEG ((enum yytokentype)tEMBDOC_BEG)
tEMBDOC,
+# define tEMBDOC ((enum yytokentype)tEMBDOC)
tEMBDOC_END,
+# define tEMBDOC_END ((enum yytokentype)tEMBDOC_END)
tHEREDOC_BEG,
+# define tHEREDOC_BEG ((enum yytokentype)tHEREDOC_BEG)
tHEREDOC_END,
- k__END__
+# define tHEREDOC_END ((enum yytokentype)tHEREDOC_END)
+ k__END__,
+# define k__END__ ((enum yytokentype)k__END__)
};
typedef struct {