diff mbox series

[1/2] cgcc: gendeps for -MM, -MD & -MMD too

Message ID 20190220133423.77834-2-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series cgcc: handle -MM, -MD, -MMD, -MF, -MQ & -MT | expand

Commit Message

Luc Van Oostenryck Feb. 20, 2019, 1:34 p.m. UTC
These flags must set '$gendeps', just like a plain '-M' do,
since they implies '-M'.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 cgcc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ilya Maximets April 24, 2019, 1:12 p.m. UTC | #1
On 20.02.2019 16:34, Luc Van Oostenryck wrote:
> These flags must set '$gendeps', just like a plain '-M' do,
> since they implies '-M'.
> 
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> ---

Hi.

Unlike simple '-M', '-MD' and '-MMD' doesn't imply '-E'. And according
to man: "Since -E is not implied, -MD can be used to generate a
dependency output file as a side-effect of the compilation process."

Open vSwitch uses "sparse" for static analysis in TravisCI and also
recommends it to developers. But this patch forces "sparse" to skip
almost all OVS source files. This happens because 'make' uses '-MD'
for dependency generation as a side effect within compiling commands.

Does this patch fixes any real issue with kernel? I think it should
be reverted or re-worked to handle 'MD|MMD' properly.
What do you think?

For now, we'll have to revert it locally before running CI builds:
    https://patchwork.ozlabs.org/patch/1090135/

Best regards, Ilya Maximets.

>  cgcc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/cgcc b/cgcc
> index 629124b94..6d3b10a20 100755
> --- a/cgcc
> +++ b/cgcc
> @@ -49,7 +49,7 @@ while (@ARGV) {
>  
>      $m32 = 1 if /^-m32$/;
>      $m64 = 1 if /^-m64$/;
> -    $gendeps = 1 if /^-M$/;
> +    $gendeps = 1 if /^-(M|MM|MD|MMD)$/;
>  
>      if (/^-target=(.*)$/) {
>  	$check .= &add_specs ($1);
>
Luc Van Oostenryck Sept. 25, 2019, 10:24 p.m. UTC | #2
On Wed, Apr 24, 2019 at 04:12:32PM +0300, Ilya Maximets wrote:
> On 20.02.2019 16:34, Luc Van Oostenryck wrote:
> > These flags must set '$gendeps', just like a plain '-M' do,
> > since they implies '-M'.
> > 
> > Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> > ---
> 
> Hi.
> 
> Unlike simple '-M', '-MD' and '-MMD' doesn't imply '-E'. And according
> to man: "Since -E is not implied, -MD can be used to generate a
> dependency output file as a side-effect of the compilation process."

Yes, this should be fixed now in sparse's repository.
Thanks and sorry for this huge delay.

-- Luc Van Oostenryck
diff mbox series

Patch

diff --git a/cgcc b/cgcc
index 629124b94..6d3b10a20 100755
--- a/cgcc
+++ b/cgcc
@@ -49,7 +49,7 @@  while (@ARGV) {
 
     $m32 = 1 if /^-m32$/;
     $m64 = 1 if /^-m64$/;
-    $gendeps = 1 if /^-M$/;
+    $gendeps = 1 if /^-(M|MM|MD|MMD)$/;
 
     if (/^-target=(.*)$/) {
 	$check .= &add_specs ($1);