Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Commit

Permalink
Close #326 (CLANG warnings about some enum hackery...)
Browse files Browse the repository at this point in the history
It's a pretty convoluted workaround for some annoying C++ restrictions.
And some CLANG versions -- unfortunately including the one in the GitHub
Ubuntu GHA runner... -- even crashed on it, so it used to be even more
convoluted, also having to work around that... But this commit is a new
test to see if that broken version has been replaced at GH perhaps...
  • Loading branch information
xparq committed Aug 3, 2023
1 parent 4485a3a commit 35c4ba8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
11 changes: 8 additions & 3 deletions include/sfw/Geometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,19 @@ namespace sfw
//!! there's no mandatory `Orientation::` qualifiers, but only for selected
//!! names, where that makes sense. Also, implicit num. conversions work.
{
enum _symbolic_ : int {
Unknown = sfw::Param::Unknown, //!! The extra `Param::` is for trying to avoid a CLANG-14 crash! :-o
UseDefault = sfw::Param::UseDefault,
enum _symbolic_ : int
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"
//!! Note: an extra `Param::` for these two may be needed to work around a CLANG-14 crash I encountered! :-o
Unknown = sfw::Unknown,
UseDefault = sfw::UseDefault,
// `Default` would be hopelessly ambiguous: should it directly
// encode a value (like `Horizontal`), and then remain hardcoded
// + possibly too context-specific forever, or should it have a
// dedicated pseudo-value meaning "use the actually configured
// default for the given usage context"?...
#pragma clang diagnostic pop

Horizontal = 1,
Vertical = Horizontal << 1, // Support Horizontal|Vertical
Expand Down
14 changes: 9 additions & 5 deletions include/sfw/util/generic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

namespace sfw
{
struct _unnamed_enum_Param_thanks_cplusplus_
// struct _Param__manually_scoped_enum_thanks_cplusplus_
struct Param
{
enum _symbolic_ : int {
Unknown = 0,
Expand All @@ -13,11 +14,14 @@ namespace sfw
operator int() { return value; }
};

using _unnamed_enum_Param_thanks_cplusplus_::Unknown,
_unnamed_enum_Param_thanks_cplusplus_::UseDefault;
/* using _Param__manually_scoped_enum_thanks_cplusplus_::Unknown,
_Param__manually_scoped_enum_thanks_cplusplus_::UseDefault;
*/
using Param::Unknown,
Param::UseDefault;

//!! The extra ceremony is for trying to avoid a CLANG-14 crash! :-o
using Param = _unnamed_enum_Param_thanks_cplusplus_;
// //!! And this extra renaming ceremony is for trying to avoid a CLANG-14 crash on the GitHub Ubuntu GHA runner! :-o
// using Param = _Param__manually_scoped_enum_thanks_cplusplus_;

} // namespace

Expand Down

0 comments on commit 35c4ba8

Please sign in to comment.