g++ - How to suppress warnings for 'void*' to 'foo*' conversions (reduced from errors by -fpermissive) -


i'm trying compile c code g++ (yes, on purpose). i'm getting errors (for example):

error: invalid conversion 'void*' 'unsigned char*' [-fpermissive] 

adding -fpermissive compilation options gets me:

error: invalid conversion 'void*' 'unsigned char*' [-werror=permissive] 

which seems error because of -werror, adding -wno-error=permissive -wno-permissive results in:

error: -werror=permissive: no option -wpermissive error: unrecognized command line option "-wno-permissive" [-werror] 

how disable warnings (globaly) conversions void* other pointer types?

you cannot "disable warnings conversions void* other pointer types" because not warning - syntax error.

what's happening here using -fpermissive downgrades errors - including 1 - warnings, , therefore allows compile some non-conforming code (obviously many types of syntax errors, such missing braces, cannot downgraded warnings since compiler cannot know how fix them turn them understandable code).

then, using -werror upgrades warnings errors, including "warnings" -fpermissive has turned error into.

-wno-error used negate -werror, i.e. causes -werror treat warnings errors except warnings specified -wno-error, remain warnings. -w flag suggests, both these flags work warnings, can't particular issue, since have here error. there no "warning" kind of invalid conversion can switch off , on -werror because it's not real warning - it's error -fpermissive merely causing treated warning.

you can compile non-comforming code, in case, using -fpermissive , not using -werror. still give warning, warnings, won't prevent successful compilation. if deliberately trying compile non-conforming code, using -werror makes no sense, because know code contains errors , therefore result in warnings, -fpermissive, specifying -werror equivalent saying "please not compile non-conforming code, though i've asked to."

the furthest can go g++ suppress warnings use -fsyntax-only check syntax errors , nothing else, since have here syntax error, won't you, , best can have turned warning -fpermissive.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -