diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-10-26 01:58:44 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-10-26 01:58:44 -0700 |
commit | e35e627e24bb2336769245d33930c3e42fc89d51 (patch) | |
tree | 29e5f74d8c0db16eda7355fb4c01c503ff6d30b3 | |
parent | af623d27b590f3596b219c9be2faa1853f8d9db4 (diff) | |
download | txr-e35e627e24bb2336769245d33930c3e42fc89d51.tar.gz txr-e35e627e24bb2336769245d33930c3e42fc89d51.tar.bz2 txr-e35e627e24bb2336769245d33930c3e42fc89d51.zip |
lib: or2: define in GCC-specific way.
* lib.h (or2): Define simply using the ?: operator from
GNU C, eliminating the explicit temporary variable.
(uses_or2): For GNU C, we make this a dummy, harmless
declaration. If memory serves me, one of the few good ways
to do that it without eliciting unused warnings is to
declare an enum.
-rw-r--r-- | lib.h | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1442,9 +1442,13 @@ INLINE int null_or_missing_p(val v) { return (nilp(v) || missingp(v)); } #define if3(a, b, c) ((a) ? (b) : (c)) +#ifdef __GNUC__ +#define uses_or2 enum { f_o_o_ ## __LINE__ } +#define or2(a, b) ((a) ?: (b)) +#else #define uses_or2 val or2_temp - #define or2(a, b) ((or2_temp = (a)) ? or2_temp : (b)) +#endif #define or3(a, b, c) or2(a, or2(b, c)) |