How to enable _all_ warnings with -fpermissive from g++?












0















There seem to be cases where the -fpermissive option results in errors being ignored altogether, rather than "downgraded" to warnings, as widely available documentation suggests.



The -Wall option is clearly not enough. What other options are needed in order to have all such downgraded warnings reported by g++?



An example came up with the Nodejs C++ addon library.



In file included from /opt/nodejs/linux64/8.9.4/include/node/node.h:63:0,
from /opt/nan/linux64/2.9.2/include/nan.h:51,
from /build/ndjs/include/blob.h:59,
from /build/ndjs/src/blob.cpp:2:
/opt/nodejs/linux64/8.9.4/include/node/v8.h: In instantiation of ‘v8::Local<T>::Local(v8::Local<S>) [with S = v8::Integer; T = v8::Int32]’:
/build/src/ndjs/blob.cpp:507:1: required from here
/opt/nodejs/linux64/8.9.4/include/node/v8.h:207:5: error: invalid conversion from ‘v8::Integer*’ to ‘v8::Int32*’ [-fpermissive]
TYPE_CHECK(T, S);
^


Recompiling with -fpermissive (and -Wall, of course) results in a clean compile: no warnings at all. What happened? (i.e. Why?)



The TYPE_CHECK() macro tests for type compatibility in pointer assignments:



#define TYPE_CHECK(T, S)                                       
while (false) {
*(static_cast<T* volatile*>(0)) = static_cast<S*>(0);
}


It fails for downcasts (v8::Int32 is derived from v8::Integer), but somehow succeeds without warnings when -fpermissive is in effect. Shouldn't there be a warning about the static downcast?










share|improve this question




















  • 1





    -fpermissive is supposed to be used for compiler development / testing purposes, you should never use it to compile regular code and / or expect to get any particular results from doing so.

    – VTT
    Nov 19 '18 at 16:59













  • -fpermissive happened. If you have to tell the compiler to devieate from the standard then you probably need to rethink what your doing in the first place. -Wall is your default.

    – johnathan
    Nov 19 '18 at 17:36











  • Instead of trashing -fpermissive, which I can do as well as anyone, please try to address the question: how are downgraded warnings enabled? This comes often when dealing with third party code.

    – arayq2
    Nov 19 '18 at 17:40
















0















There seem to be cases where the -fpermissive option results in errors being ignored altogether, rather than "downgraded" to warnings, as widely available documentation suggests.



The -Wall option is clearly not enough. What other options are needed in order to have all such downgraded warnings reported by g++?



An example came up with the Nodejs C++ addon library.



In file included from /opt/nodejs/linux64/8.9.4/include/node/node.h:63:0,
from /opt/nan/linux64/2.9.2/include/nan.h:51,
from /build/ndjs/include/blob.h:59,
from /build/ndjs/src/blob.cpp:2:
/opt/nodejs/linux64/8.9.4/include/node/v8.h: In instantiation of ‘v8::Local<T>::Local(v8::Local<S>) [with S = v8::Integer; T = v8::Int32]’:
/build/src/ndjs/blob.cpp:507:1: required from here
/opt/nodejs/linux64/8.9.4/include/node/v8.h:207:5: error: invalid conversion from ‘v8::Integer*’ to ‘v8::Int32*’ [-fpermissive]
TYPE_CHECK(T, S);
^


Recompiling with -fpermissive (and -Wall, of course) results in a clean compile: no warnings at all. What happened? (i.e. Why?)



The TYPE_CHECK() macro tests for type compatibility in pointer assignments:



#define TYPE_CHECK(T, S)                                       
while (false) {
*(static_cast<T* volatile*>(0)) = static_cast<S*>(0);
}


It fails for downcasts (v8::Int32 is derived from v8::Integer), but somehow succeeds without warnings when -fpermissive is in effect. Shouldn't there be a warning about the static downcast?










share|improve this question




















  • 1





    -fpermissive is supposed to be used for compiler development / testing purposes, you should never use it to compile regular code and / or expect to get any particular results from doing so.

    – VTT
    Nov 19 '18 at 16:59













  • -fpermissive happened. If you have to tell the compiler to devieate from the standard then you probably need to rethink what your doing in the first place. -Wall is your default.

    – johnathan
    Nov 19 '18 at 17:36











  • Instead of trashing -fpermissive, which I can do as well as anyone, please try to address the question: how are downgraded warnings enabled? This comes often when dealing with third party code.

    – arayq2
    Nov 19 '18 at 17:40














0












0








0








There seem to be cases where the -fpermissive option results in errors being ignored altogether, rather than "downgraded" to warnings, as widely available documentation suggests.



The -Wall option is clearly not enough. What other options are needed in order to have all such downgraded warnings reported by g++?



An example came up with the Nodejs C++ addon library.



In file included from /opt/nodejs/linux64/8.9.4/include/node/node.h:63:0,
from /opt/nan/linux64/2.9.2/include/nan.h:51,
from /build/ndjs/include/blob.h:59,
from /build/ndjs/src/blob.cpp:2:
/opt/nodejs/linux64/8.9.4/include/node/v8.h: In instantiation of ‘v8::Local<T>::Local(v8::Local<S>) [with S = v8::Integer; T = v8::Int32]’:
/build/src/ndjs/blob.cpp:507:1: required from here
/opt/nodejs/linux64/8.9.4/include/node/v8.h:207:5: error: invalid conversion from ‘v8::Integer*’ to ‘v8::Int32*’ [-fpermissive]
TYPE_CHECK(T, S);
^


Recompiling with -fpermissive (and -Wall, of course) results in a clean compile: no warnings at all. What happened? (i.e. Why?)



The TYPE_CHECK() macro tests for type compatibility in pointer assignments:



#define TYPE_CHECK(T, S)                                       
while (false) {
*(static_cast<T* volatile*>(0)) = static_cast<S*>(0);
}


It fails for downcasts (v8::Int32 is derived from v8::Integer), but somehow succeeds without warnings when -fpermissive is in effect. Shouldn't there be a warning about the static downcast?










share|improve this question
















There seem to be cases where the -fpermissive option results in errors being ignored altogether, rather than "downgraded" to warnings, as widely available documentation suggests.



The -Wall option is clearly not enough. What other options are needed in order to have all such downgraded warnings reported by g++?



An example came up with the Nodejs C++ addon library.



In file included from /opt/nodejs/linux64/8.9.4/include/node/node.h:63:0,
from /opt/nan/linux64/2.9.2/include/nan.h:51,
from /build/ndjs/include/blob.h:59,
from /build/ndjs/src/blob.cpp:2:
/opt/nodejs/linux64/8.9.4/include/node/v8.h: In instantiation of ‘v8::Local<T>::Local(v8::Local<S>) [with S = v8::Integer; T = v8::Int32]’:
/build/src/ndjs/blob.cpp:507:1: required from here
/opt/nodejs/linux64/8.9.4/include/node/v8.h:207:5: error: invalid conversion from ‘v8::Integer*’ to ‘v8::Int32*’ [-fpermissive]
TYPE_CHECK(T, S);
^


Recompiling with -fpermissive (and -Wall, of course) results in a clean compile: no warnings at all. What happened? (i.e. Why?)



The TYPE_CHECK() macro tests for type compatibility in pointer assignments:



#define TYPE_CHECK(T, S)                                       
while (false) {
*(static_cast<T* volatile*>(0)) = static_cast<S*>(0);
}


It fails for downcasts (v8::Int32 is derived from v8::Integer), but somehow succeeds without warnings when -fpermissive is in effect. Shouldn't there be a warning about the static downcast?







c++ g++






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 '18 at 18:03







arayq2

















asked Nov 19 '18 at 16:52









arayq2arayq2

1,987916




1,987916








  • 1





    -fpermissive is supposed to be used for compiler development / testing purposes, you should never use it to compile regular code and / or expect to get any particular results from doing so.

    – VTT
    Nov 19 '18 at 16:59













  • -fpermissive happened. If you have to tell the compiler to devieate from the standard then you probably need to rethink what your doing in the first place. -Wall is your default.

    – johnathan
    Nov 19 '18 at 17:36











  • Instead of trashing -fpermissive, which I can do as well as anyone, please try to address the question: how are downgraded warnings enabled? This comes often when dealing with third party code.

    – arayq2
    Nov 19 '18 at 17:40














  • 1





    -fpermissive is supposed to be used for compiler development / testing purposes, you should never use it to compile regular code and / or expect to get any particular results from doing so.

    – VTT
    Nov 19 '18 at 16:59













  • -fpermissive happened. If you have to tell the compiler to devieate from the standard then you probably need to rethink what your doing in the first place. -Wall is your default.

    – johnathan
    Nov 19 '18 at 17:36











  • Instead of trashing -fpermissive, which I can do as well as anyone, please try to address the question: how are downgraded warnings enabled? This comes often when dealing with third party code.

    – arayq2
    Nov 19 '18 at 17:40








1




1





-fpermissive is supposed to be used for compiler development / testing purposes, you should never use it to compile regular code and / or expect to get any particular results from doing so.

– VTT
Nov 19 '18 at 16:59







-fpermissive is supposed to be used for compiler development / testing purposes, you should never use it to compile regular code and / or expect to get any particular results from doing so.

– VTT
Nov 19 '18 at 16:59















-fpermissive happened. If you have to tell the compiler to devieate from the standard then you probably need to rethink what your doing in the first place. -Wall is your default.

– johnathan
Nov 19 '18 at 17:36





-fpermissive happened. If you have to tell the compiler to devieate from the standard then you probably need to rethink what your doing in the first place. -Wall is your default.

– johnathan
Nov 19 '18 at 17:36













Instead of trashing -fpermissive, which I can do as well as anyone, please try to address the question: how are downgraded warnings enabled? This comes often when dealing with third party code.

– arayq2
Nov 19 '18 at 17:40





Instead of trashing -fpermissive, which I can do as well as anyone, please try to address the question: how are downgraded warnings enabled? This comes often when dealing with third party code.

– arayq2
Nov 19 '18 at 17:40












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53379298%2fhow-to-enable-all-warnings-with-fpermissive-from-g%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53379298%2fhow-to-enable-all-warnings-with-fpermissive-from-g%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)