https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87310

            Bug ID: 87310
           Summary: -Wc90-c99-compat does not warn about bool usage
           Product: gcc
           Version: 8.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kohanyi.robert at gmail dot com
  Target Milestone: ---

Created attachment 44694
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44694&action=edit
gcc -v outputs

When compiling code that uses <stdbool.h> and bool declarations with
-Wc90-c99-compat (with or without -std=c90), no diagnostic is issued.

Something like this

#include <stdio.h>
#include <stdbool.h>
main() {
        bool ok = true;
        printf("%u\n", ok);
}

when compiled with

gcc -std=c90 -Wc90-c99-compat a.c

there's no warning, but I expected a warn about bool usage.

When it looks like this

#include <stdio.h>
main() {
        _Bool ok = 1;
        printf("%u\n", ok);
}

the warning `warning: ISO C90 does not support boolean types
[-Wc90-c99-compat]' is raised.

Tried with multiple version of gcc. Attached the output of different gcc -v
runs.

Try it here at tio.run: https://bit.ly/2CXnvXm
StackOverflow thread: https://stackoverflow.com/questions/52307780

Reply via email to