[PATCH] D32341: Fix a bug that warnings generated with -M or -MM flags
yamaguchi closed this revision. yamaguchi added a comment. Landed in r305561. https://reviews.llvm.org/D32341 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32341: Fix a bug that warnings generated with -M or -MM flags
teemperor accepted this revision. teemperor added a comment. This revision is now accepted and ready to land. LGTM, good job! (Sorry for the delay, I think I got interrupted here by the GSoC start...) https://reviews.llvm.org/D32341 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32341: Fix a bug that warnings generated with -M or -MM flags
yamaguchi added a comment. @teemperor ping..? https://reviews.llvm.org/D32341 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32341: Fix a bug that warnings generated with -M or -MM flags
v.g.vassilev added a comment. @teemperor, is this ok with you? https://reviews.llvm.org/D32341 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32341: Fix a bug that warnings generated with -M or -MM flags
yamaguchi updated this revision to Diff 97019. yamaguchi added a comment. Add testcase https://reviews.llvm.org/D32341 Files: lib/Driver/ToolChains/Clang.cpp test/Driver/m_and_mm.c Index: test/Driver/m_and_mm.c === --- test/Driver/m_and_mm.c +++ test/Driver/m_and_mm.c @@ -1,3 +1,15 @@ // RUN: %clang -### \ // RUN: -M -MM %s 2> %t // RUN: not grep '"-sys-header-deps"' %t + +// RUN: %clang -M -MM %s 2> %t +// RUN: not grep "warning" %t + +// RUN: %clang -MMD -MD %s 2> %t +// RUN: grep "warning" %t + +#warning "This warning shouldn't show up with -M and -MM" +int main (void) +{ +return 0; +} Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -980,6 +980,9 @@ DepTarget = Args.MakeArgString(llvm::sys::path::filename(P)); } + if (!A->getOption().matches(options::OPT_MD) && !A->getOption().matches(options::OPT_MMD)) { +CmdArgs.push_back("-w"); + } CmdArgs.push_back("-MT"); SmallString<128> Quoted; QuoteTarget(DepTarget, Quoted); Index: test/Driver/m_and_mm.c === --- test/Driver/m_and_mm.c +++ test/Driver/m_and_mm.c @@ -1,3 +1,15 @@ // RUN: %clang -### \ // RUN: -M -MM %s 2> %t // RUN: not grep '"-sys-header-deps"' %t + +// RUN: %clang -M -MM %s 2> %t +// RUN: not grep "warning" %t + +// RUN: %clang -MMD -MD %s 2> %t +// RUN: grep "warning" %t + +#warning "This warning shouldn't show up with -M and -MM" +int main (void) +{ +return 0; +} Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -980,6 +980,9 @@ DepTarget = Args.MakeArgString(llvm::sys::path::filename(P)); } + if (!A->getOption().matches(options::OPT_MD) && !A->getOption().matches(options::OPT_MMD)) { +CmdArgs.push_back("-w"); + } CmdArgs.push_back("-MT"); SmallString<128> Quoted; QuoteTarget(DepTarget, Quoted); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32341: Fix a bug that warnings generated with -M or -MM flags
yamaguchi updated this revision to Diff 97013. yamaguchi added a comment. show warnings with -M and -MD https://reviews.llvm.org/D32341 Files: lib/Driver/ToolChains/Clang.cpp test/Driver/m_and_mm.c Index: test/Driver/m_and_mm.c === --- test/Driver/m_and_mm.c +++ test/Driver/m_and_mm.c @@ -1,3 +1,7 @@ // RUN: %clang -### \ // RUN: -M -MM %s 2> %t // RUN: not grep '"-sys-header-deps"' %t + +#warning "This warning shouldn't show up with -M and -MM" +// RUN: %clang -M -MM %s 2> %t +// RUN: not grep "warning" %t Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -980,6 +980,9 @@ DepTarget = Args.MakeArgString(llvm::sys::path::filename(P)); } + if (!A->getOption().matches(options::OPT_MD) && !A->getOption().matches(options::OPT_MMD)) { +CmdArgs.push_back("-w"); + } CmdArgs.push_back("-MT"); SmallString<128> Quoted; QuoteTarget(DepTarget, Quoted); Index: test/Driver/m_and_mm.c === --- test/Driver/m_and_mm.c +++ test/Driver/m_and_mm.c @@ -1,3 +1,7 @@ // RUN: %clang -### \ // RUN: -M -MM %s 2> %t // RUN: not grep '"-sys-header-deps"' %t + +#warning "This warning shouldn't show up with -M and -MM" +// RUN: %clang -M -MM %s 2> %t +// RUN: not grep "warning" %t Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -980,6 +980,9 @@ DepTarget = Args.MakeArgString(llvm::sys::path::filename(P)); } + if (!A->getOption().matches(options::OPT_MD) && !A->getOption().matches(options::OPT_MMD)) { +CmdArgs.push_back("-w"); + } CmdArgs.push_back("-MT"); SmallString<128> Quoted; QuoteTarget(DepTarget, Quoted); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32341: Fix a bug that warnings generated with -M or -MM flags
v.g.vassilev added a comment. I think you will see the issue if you add a negative test case, too. I.e. as Raphael said in `-MD` and `-MMD` mode we should be able to see warnings. https://reviews.llvm.org/D32341 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32341: Fix a bug that warnings generated with -M or -MM flags
yamaguchi added a comment. Do you think it is not a good idea to change condition if -MD or -MMD exists? for example, if ( !A->getOption().matches(options::OPT_MD) && !A->getOption().matches(options::OPT_MQ)) CmdArgs.push_back("-w"); https://reviews.llvm.org/D32341 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32341: Fix a bug that warnings generated with -M or -MM flags
teemperor requested changes to this revision. teemperor added a comment. This revision now requires changes to proceed. This also disables warnings for `-MD` and `-MMD` which shouldn't happen as we're actually compiling code here and are probably compiling a project. E.g. for people that use this mode to create dependency files while initially building (to figure out when to rebuild each object), this will effectively force `-w` to the whole build process which is not good. I would just manually check for `-M` and `-MM` where we only run the preprocessor and where adding `-w` is safe. Also please add another test that we actually get the warnings for `-MD` and another one for `-MMD`. Otherwise this look good. https://reviews.llvm.org/D32341 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32341: Fix a bug that warnings generated with -M or -MM flags
yamaguchi updated this revision to Diff 96283. yamaguchi added a comment. Fixed typo. https://reviews.llvm.org/D32341 Files: lib/Driver/ToolChains/Clang.cpp test/Driver/m_and_mm.c Index: test/Driver/m_and_mm.c === --- test/Driver/m_and_mm.c +++ test/Driver/m_and_mm.c @@ -1,3 +1,7 @@ // RUN: %clang -### \ // RUN: -M -MM %s 2> %t // RUN: not grep '"-sys-header-deps"' %t + +// RUN: %clang -M -MM %s 2> %t +// RUN: not grep "warning" %t +#warning "This warning shouldn't show up with -M and -MM" Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -980,6 +980,7 @@ DepTarget = Args.MakeArgString(llvm::sys::path::filename(P)); } + CmdArgs.push_back("-w"); CmdArgs.push_back("-MT"); SmallString<128> Quoted; QuoteTarget(DepTarget, Quoted); Index: test/Driver/m_and_mm.c === --- test/Driver/m_and_mm.c +++ test/Driver/m_and_mm.c @@ -1,3 +1,7 @@ // RUN: %clang -### \ // RUN: -M -MM %s 2> %t // RUN: not grep '"-sys-header-deps"' %t + +// RUN: %clang -M -MM %s 2> %t +// RUN: not grep "warning" %t +#warning "This warning shouldn't show up with -M and -MM" Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -980,6 +980,7 @@ DepTarget = Args.MakeArgString(llvm::sys::path::filename(P)); } + CmdArgs.push_back("-w"); CmdArgs.push_back("-MT"); SmallString<128> Quoted; QuoteTarget(DepTarget, Quoted); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32341: Fix a bug that warnings generated with -M or -MM flags
v.g.vassilev added a comment. LGTM modulo the comments. Comment at: test/Driver/m_and_mm.c:7 +// RUN: not grep "warning" %t +#warning "This warning shouldn't shop up with -M and -MM" Typo. https://reviews.llvm.org/D32341 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32341: Fix a bug that warnings generated with -M or -MM flags
yamaguchi updated this revision to Diff 96273. yamaguchi added a comment. Add testcase. https://reviews.llvm.org/D32341 Files: lib/Driver/ToolChains/Clang.cpp test/Driver/m_and_mm.c Index: test/Driver/m_and_mm.c === --- test/Driver/m_and_mm.c +++ test/Driver/m_and_mm.c @@ -1,3 +1,7 @@ // RUN: %clang -### \ // RUN: -M -MM %s 2> %t // RUN: not grep '"-sys-header-deps"' %t + +// RUN: %clang -M -MM %s 2> %t +// RUN: not grep "warning" %t +#warning "This warning shouldn't shop up with -M and -MM" Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -980,6 +980,7 @@ DepTarget = Args.MakeArgString(llvm::sys::path::filename(P)); } + CmdArgs.push_back("-w"); CmdArgs.push_back("-MT"); SmallString<128> Quoted; QuoteTarget(DepTarget, Quoted); Index: test/Driver/m_and_mm.c === --- test/Driver/m_and_mm.c +++ test/Driver/m_and_mm.c @@ -1,3 +1,7 @@ // RUN: %clang -### \ // RUN: -M -MM %s 2> %t // RUN: not grep '"-sys-header-deps"' %t + +// RUN: %clang -M -MM %s 2> %t +// RUN: not grep "warning" %t +#warning "This warning shouldn't shop up with -M and -MM" Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -980,6 +980,7 @@ DepTarget = Args.MakeArgString(llvm::sys::path::filename(P)); } + CmdArgs.push_back("-w"); CmdArgs.push_back("-MT"); SmallString<128> Quoted; QuoteTarget(DepTarget, Quoted); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32341: Fix a bug that warnings generated with -M or -MM flags
v.g.vassilev added a comment. Could you add a test case? https://reviews.llvm.org/D32341 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32341: Fix a bug that warnings generated with -M or -MM flags
yamaguchi created this revision. This is a patch for bug [1] Warnings should not be emitted with -M and -MM flags, because this mode is only used for generate MakeFiles. [1]: https://bugs.llvm.org/show_bug.cgi?id=6817 https://reviews.llvm.org/D32341 Files: lib/Driver/ToolChains/Clang.cpp Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -980,6 +980,7 @@ DepTarget = Args.MakeArgString(llvm::sys::path::filename(P)); } + CmdArgs.push_back("-w"); CmdArgs.push_back("-MT"); SmallString<128> Quoted; QuoteTarget(DepTarget, Quoted); Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -980,6 +980,7 @@ DepTarget = Args.MakeArgString(llvm::sys::path::filename(P)); } + CmdArgs.push_back("-w"); CmdArgs.push_back("-MT"); SmallString<128> Quoted; QuoteTarget(DepTarget, Quoted); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits