'#pragma GCC system_header' changes vs. 'ignore' for 'std::tr1::tie'
Thomas Schwinge
tschwinge@baylibre.com
Tue Oct 1 06:53:08 GMT 2024
Hi!
When building libstdc++-v3 with '--enable-werror', the build currently fails:
[...]
In file included from [...]/build-gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/functional:42,
from ../../../../../source-gcc/libstdc++-v3/src/c++98/hash_tr1.cc:27:
[...]/build-gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/tuple:426:21: error: ‘std::tr1::{anonymous}::ignore’ defined but not used [-Werror=unused-variable]
426 | _Swallow_assign ignore;
| ^~~~~~
cc1plus: all warnings being treated as errors
make[5]: *** [Makefile:658: hash_tr1.lo] Error 1
[...]
In file included from [...]/build-gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/functional:42,
from [...]/build-gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/rope:61,
from ../../../../../source-gcc/libstdc++-v3/src/c++98/ext-inst.cc:29:
[...]/build-gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/tuple:426:21: error: ‘std::tr1::{anonymous}::ignore’ defined but not used [-Werror=unused-variable]
426 | _Swallow_assign ignore;
| ^~~~~~
cc1plus: all warnings being treated as errors
make[5]: *** [Makefile:658: ext-inst.lo] Error 1
make[5]: Target 'all' not remade because of errors.
make[5]: Leaving directory '[...]/build-gcc/x86_64-pc-linux-gnu/libstdc++-v3/src/c++98'
[...]
In file included from [...]/build-gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/functional:42,
from ../../../../../source-gcc/libstdc++-v3/src/c++11/cxx11-hash_tr1.cc:32:
[...]/build-gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/tuple:426:21: error: ‘std::tr1::{anonymous}::ignore’ defined but not used [-Werror=unused-variable]
426 | _Swallow_assign ignore;
| ^~~~~~
cc1plus: all warnings being treated as errors
make[5]: *** [Makefile:681: cxx11-hash_tr1.lo] Error 1
make[5]: Target 'all' not remade because of errors.
make[5]: Leaving directory '[...]/build-gcc/x86_64-pc-linux-gnu/libstdc++-v3/src/c++11'
[...]
Should we just mute this specific '-Wunused-variable', or (if that makes
any sense) apply to 'tr1/tuple' changes similar to the 'std/tuple' onces
of commit 1489e281b549af8a76a415556c07e147df933a44
'libstdc++: Implement P2968R2 "Making std::ignore a first-class object"'?
Doing just:
--- libstdc++-v3/include/tr1/tuple
+++ libstdc++-v3/include/tr1/tuple
@@ -409,22 +409,6 @@ namespace tr1
{
return tuple<_Elements&...>(__args...);
}
-
- // A class (and instance) which can be used in 'tie' when an element
- // of a tuple is not required
- struct _Swallow_assign
- {
- template<class _Tp>
- _Swallow_assign&
- operator=(const _Tp&)
- { return *this; }
- };
-
- // TODO: Put this in some kind of shared file.
- namespace
- {
- _Swallow_assign ignore;
- } // anonymous namespace
}
_GLIBCXX_END_NAMESPACE_VERSION
... is not sufficient:
[-PASS:-]{+FAIL:+} tr1/6_containers/headers/tuple/types_std_tr1.cc -std=gnu++17 (test for excess errors)
[...]/source-gcc/libstdc++-v3/testsuite/tr1/6_containers/headers/tuple/types_std_tr1.cc:24: error: 'ignore' has not been declared in 'std::tr1'
[-PASS:-]{+FAIL:+} tr1/6_containers/tuple/cons/big_tuples.cc -std=gnu++17 (test for excess errors)
[-PASS:-]{+UNRESOLVED:+} tr1/6_containers/tuple/cons/big_tuples.cc -std=gnu++17 [-execution test-]{+compilation failed to produce executable+}
[...]/source-gcc/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/big_tuples.cc: In function 'int main()':
[...]/source-gcc/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/big_tuples.cc:85: error: 'ignore' was not declared in this scope; did you mean 'std::ignore'?
In file included from [...]/build-gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_pair.h:62,
from [...]/build-gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/utility:71,
from [...]/build-gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/tuple:44,
from [...]/source-gcc/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/big_tuples.cc:22:
[...]/build-gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/utility.h:309: note: 'std::ignore' declared here
[-PASS:-]{+FAIL:+} tr1/6_containers/tuple/creation_functions/tie2.cc -std=gnu++17 (test for excess errors)
[-PASS:-]{+UNRESOLVED:+} tr1/6_containers/tuple/creation_functions/tie2.cc -std=gnu++17 [-execution test-]{+compilation failed to produce executable+}
[...]/source-gcc/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie2.cc: In function 'int main()':
[...]/source-gcc/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie2.cc:32: error: 'ignore' was not declared in this scope; did you mean 'std::ignore'?
In file included from [...]/build-gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_pair.h:62,
from [...]/build-gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/utility:71,
from [...]/build-gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/tuple:44,
from [...]/source-gcc/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie2.cc:20:
[...]/build-gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/utility.h:309: note: 'std::ignore' declared here
Grüße
Thomas
More information about the Libstdc++
mailing list