Comments (6)
@martinmoene, thanks for the suggestion, I think that might indeed be better than suppressing all these warnings in all of our test suite.
from gsl-lite.
Thank you for the report. The problem might be related to this change to the PCH setup. Previously, we had simply set gsl-lite.t.hpp as the precompiled header; but apparently this didn't interact well with the warning suppressions in that header file; at least I had to address several previously unseen warnings after making these changes.
As a general rule, I would like to avoid unconditional warning suppressions for current compiler versions. "-Wno-long-long", being relevant only for C++98, is an exception; "-Wuseless-cast" unconditionally enables the warning which is fine.
(Edit: pardon me, I had only looked at MakeTestTarget.cmake. We indeed have a lot of unconditional warning suppressions in gsl-lite.t.hpp, "-Wuseless-cast" being among them. As a comment there points out, this is required to pacify the compiler with regard to lest. I aim to eventually replace our outdated and somewhat customized copy of lest with Catch2.)
If the warning appears only once, I'd prefer to work around locally, either by suppressing it:
inline bool unprintable( char c )
{
#if defined (__GNUC__)
# pragma GCC diagnostic suppress "-Wtype-limits" // comparison is always true due to limited range of data type
#endif // defined (__GNUC__)
return 0 <= c && c < ' ';
}
or by casting c
to signed char
:
inline bool unprintable( char c ) { return 0 <= static_cast<signed char>(c) && c < ' '; }
Would you mind verifying if either of these fixes the issue, and possibly issuing a PR?
Edit: you can also add "-Wtype-limits" to the ignored diagnostics in gsl-lite.t.hpp if you like. I'll find it there if I ever get around to replacing lest.
from gsl-lite.
An intermediate step could perhaps be to suppress lest's warnings by handling it as a system header. See e.g. this commit of string_view lite.
from gsl-lite.
Thank you for the report. The problem might be related to this change to the PCH setup. Previously, we had simply set gsl-lite.t.hpp as the precompiled header; but apparently this didn't interact well with the warning suppressions in that header file; at least I had to address several previously unseen warnings after making these changes.
Thanks for explaining that; it seems like a plausible root cause.
As a general rule, I would like to avoid unconditional warning suppressions for current compiler versions. […]
If the warning appears only once, I'd prefer to work around locally, either by suppressing it:
[…]
or by casting
c
tosigned char
:[…]
Would you mind verifying if either of these fixes the issue, and possibly issuing a PR?
Thanks for the suggestions. Both of these look reasonable; if you have no particular preference, I think I prefer the cast. I’ve tested it as a patch and opened a PR.
from gsl-lite.
Thanks for the contribution. Do you need a patch release (v0.41.1) as soon as possible? If not, I'd let it sit for a few days before issuing a release in case there is more fallout.
from gsl-lite.
Thanks for the contribution. Do you need a patch release (v0.41.1) as soon as possible? If not, I'd let it sit for a few days before issuing a release in case there is more fallout.
There is no hurry at all. Thanks for working on this.
from gsl-lite.
Related Issues (20)
- `not_null<>` should be hashable HOT 2
- Should `not_null<>` be two different classes? HOT 3
- "illegal instruction" Error when using gsl::span as Kernel Parameter HOT 3
- Test compilation failures on GCC 11: error: array subscript -1 is outside array bounds of 'char[6]' [-Werror=array-bounds] HOT 7
- Test failures on s390x (GCC 10.2.1 and 11.0.1) HOT 7
- Support `narrow<>()` for types without total order
- `not_null<shared_ptr<T>>` not convertible to `weak_ptr<T>` HOT 1
- gsl_FEATURE_GSL_LITE_NAMESPACE not working HOT 3
- Definition of `fail_fast` and of `narrowing_error` triggers `clang`'s `-Wweak-vtables` HOT 2
- gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME in kernel code HOT 1
- including gsl-lite triggers `-Wuseless-cast` warnings HOT 2
- Add tests for `not_null_ic<>`
- Add CI for non-x86 architectures
- Allow `not_null<void*>` and related. HOT 9
- `not_null`'s evaluation of nullness can lead to *very* cryptic errors. HOT 10
- Suppress warnings in lest via system include
- Comparison of `std::optional<not_null<T>>` and `not_null<T>` is ambiguous HOT 2
- gsl::span works differently than std::span in terms of type matching? HOT 2
- 0.41.0: not ready to be build with `-D_FORTIFY_SOURCE=3` HOT 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gsl-lite.