Search code examples
gccgcc-warning

Make warning "makes pointer from integer without a cast" as error


I'm trying to make the warning " warning: passing argument 1 of ‘func’ makes pointer from integer without a cast" as an error, but can't find the name of the option.

I've tried all warnings from

gcc -Q --help=warnings | grep enabled

Tried to either do -Werror=XXXX and name of the option from the list,

or even tried to disable warning -Wno-XXXX, and couldn't disable.

Does anybody know option for this particular warning?


Solution

  • I wanted to know it as well, so I checked the gcc source (4.8.1). In c-typeck.c there is the following code that emits the warning:

        WARN_FOR_ASSIGNMENT (location, 0,
                             G_("passing argument %d of %qE makes "
                                "pointer from integer without a cast"),
                             G_("assignment makes pointer from integer "
                                "without a cast"),
                             G_("initialization makes pointer from "
                                "integer without a cast"),
                             G_("return makes pointer from integer "
                                "without a cast"));
    

    See the 0 second argument to WAIT_FOR_ASSIGNMENT? Normally, that is the flag for one of the diagnostic options. In this case it is zero, however, so I'm afraid that this means that the error cannot be specifically made an error.