[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 9/9] glr2.cc: address warnings with G++ 4.8
From: |
Akim Demaille |
Subject: |
Re: [PATCH 9/9] glr2.cc: address warnings with G++ 4.8 |
Date: |
Mon, 14 Sep 2020 19:13:08 +0200 |
> Le 12 sept. 2020 à 16:51, Akim Demaille <akim.demaille@gmail.com> a écrit :
>
> input.cc: In constructor 'glr_stack_item::glr_stack_item(bool)':
> input.cc:1423:5: error: declaration of 'isState' shadows a member of 'this'
> [-Werror=shadow]
> : isState_(isState) {
> ^
> test.cc:1165:45: error: declaration of 'begin' shadows a member of 'this'
> [-Werror=shadow]
> test.cc:1167:45: error: declaration of 'end' shadows a member of 'this'
> [-Werror=shadow]
>
> * data/skeletons/glr2.cc (isState): Rename as...
> (is_state): this.
> Formatting changes.
> (reduceToOneStack): Rename variables to avoid name clashes.
I'm adding this.
commit 11995fec505b13e64e7e27a03e30049035cbe05a
Author: Akim Demaille <akim.demaille@gmail.com>
Date: Mon Sep 14 06:34:07 2020 +0200
glr2.cc: fix warning about local variable vs. member
Fix a warning triggered in GCC (at least from 4.6 to 4.9):
input.cc: In constructor 'glr_stack_item::glr_stack_item(bool)':
input.cc:1371:5: error: declaration of 'is_state' shadows a member of
'this' [-Werror=shadow]
: is_state_(is_state)
^
* data/skeletons/glr2.cc (glr_stack_item): Alpha-convert.
diff --git a/data/skeletons/glr2.cc b/data/skeletons/glr2.cc
index f15ab96d..a8940f64 100644
--- a/data/skeletons/glr2.cc
+++ b/data/skeletons/glr2.cc
@@ -1211,10 +1211,10 @@ class semantic_option {
class glr_stack_item
{
public:
- glr_stack_item(bool is_state = true)
- : is_state_(is_state)
+ glr_stack_item (bool state = true)
+ : is_state_ (state)
{
- if (is_state)
+ if (is_state_)
new (&raw_) glr_state;
else
new (&raw_) semantic_option;
- [PATCH 0/9] glr2.cc: warnings and style, Akim Demaille, 2020/09/12
- [PATCH 1/9] glr2.cc: add copy constructor to yyGLRStackItem, Akim Demaille, 2020/09/12
- [PATCH 2/9] glr2.cc: remove C-style casts, Akim Demaille, 2020/09/12
- [PATCH 3/9] glr2.cc: remove usage of PTRDIFF_MAX, Akim Demaille, 2020/09/12
- [PATCH 4/9] glr2.cc: move StrongIndexAlias into the namespace, Akim Demaille, 2020/09/12
- [PATCH 5/9] glr2.cc: coding style changes, Akim Demaille, 2020/09/12
- [PATCH 6/9] glr2.cc: fix GCC10 warning, Akim Demaille, 2020/09/12
- [PATCH 7/9] glr2.cc: formatting changes, Akim Demaille, 2020/09/12
- [PATCH 8/9] glr2.cc: get rid of the C indirection for yy_symbol_print, Akim Demaille, 2020/09/12
- [PATCH 9/9] glr2.cc: address warnings with G++ 4.8, Akim Demaille, 2020/09/12
- Re: [PATCH 9/9] glr2.cc: address warnings with G++ 4.8,
Akim Demaille <=