~xcb


#76 __has_builtin() falsely indicates support for certain built-in functions 2 years ago

Ticket created by ~xcb on ~mcf/cproc

The following input:

echo '__has_builtin(__builtin_add_overflow)' | cproc -E -xc -

...seems to evaluate to 1, even though the function in question doesn't seem to be supported by the compiler. I'm guessing this is due to the use of an external pre-processor?

FWIW, I ran into this problem when using code like the following:

#include <stdbool.h>
#include <stdint.h>

#ifdef __has_builtin
    #define HAS_BUILTIN(x) __has_builtin(x)
#else
    #define HAS_BUILTIN(x) 0
#endif

static inline bool size_add_overflows(size_t a, size_t b, size_t *result)
{
#if HAS_BUILTIN(__builtin_add_overflow)
    return __builtin_add_overflow(a, b, result);
#else
    if (b > SIZE_MAX - a) {
        return true;
    }
    *result = a + b;
    return false;
#endif
}

If the feature query would evaluate to 0, the fallback would work fine. However, I currently just get the following error instead:

error: undeclared identifier: __builtin_add_overflow

#26 Ignoring underscores in the middle_of_words precludes certain use cases 3 years ago

on ~sircmpwn/scdoc

REPORTED RESOLVED WONT_FIX

#26 Ignoring underscores in the middle_of_words precludes certain use cases 3 years ago

Ticket created by ~xcb on ~sircmpwn/scdoc

I just tried _width_*x*_height_ and noticed that the second underscore span is missing any formatting and is just output verbatim as _height_. I understand the reasons for this and the fact that it's just behaving as documented, but is there any way to force the underlining in this case...?