If I have a function that takes an enum
parameter, and I pass a literal that does not represent a valid enum member, can I get the compiler to emit a warning (gcc, clang, msvc?) Example code:
typedef enum {
GPIO_0,
GPIO_1,
GPIO_2,
GPIO_3
} gpio_t;
void gpio_set(gpio_t gpionum, uint8_t value) {
// ...
}
int main(int argc, const char** argv) {
// I want a warning here because there is no 5 in gpio_t:
gpio_set(5, 1);
}