💬 TheCharlatan commented on pull request "refactor: Move chain constants to the util library":
(https://github.com/bitcoin/bitcoin/pull/27491#discussion_r1187890064)
Adding `Assert(false)` seems to throw an error:
```
util/chaintype.cpp: In function ‘std::string ChainTypeToString(ChainType)’:
./util/check.h:73:89: error: control reaches end of non-void function [-Werror=return-type]
73 | #define Assert(val) inline_assertion_check<true>(val, __FILE__, __LINE__, __func__, #val)
| ^
util/chaintype.cpp:23:5: note: in expansion of macro ‘Assert’
23 | Ass
...
(https://github.com/bitcoin/bitcoin/pull/27491#discussion_r1187890064)
Adding `Assert(false)` seems to throw an error:
```
util/chaintype.cpp: In function ‘std::string ChainTypeToString(ChainType)’:
./util/check.h:73:89: error: control reaches end of non-void function [-Werror=return-type]
73 | #define Assert(val) inline_assertion_check<true>(val, __FILE__, __LINE__, __func__, #val)
| ^
util/chaintype.cpp:23:5: note: in expansion of macro ‘Assert’
23 | Ass
...
📝 maflcko opened a pull request: "util: Allow Assert() in contexts without __func__"
(https://github.com/bitcoin/bitcoin/pull/33785)
Without this, compile warnings could be hit about `__func__` being only valid inside functions.
```
warning: predefined identifier is only valid inside function [-Wpredefined-identifier-outside-function] note: expanded from macro Assert
115 | #define Assert(val) inline_assertion_check<true>(val, __FILE__, __LINE__, __func__, #val)
| ^
```
Ref https://github.com/bitcoin/bitcoin/pull/32740#discussion_r24862
...
(https://github.com/bitcoin/bitcoin/pull/33785)
Without this, compile warnings could be hit about `__func__` being only valid inside functions.
```
warning: predefined identifier is only valid inside function [-Wpredefined-identifier-outside-function] note: expanded from macro Assert
115 | #define Assert(val) inline_assertion_check<true>(val, __FILE__, __LINE__, __func__, #val)
| ^
```
Ref https://github.com/bitcoin/bitcoin/pull/32740#discussion_r24862
...