diff mbox series

[v2] Makefile: fix conditional around sparse

Message ID 20250203172905.463629-1-gwendal@chromium.org
State Superseded
Headers show
Series [v2] Makefile: fix conditional around sparse | expand

Commit Message

Gwendal Grignou Feb. 3, 2025, 5:29 p.m. UTC
sparse would always be invoked, since `ifdef C` is always true afet `C ?= xx`.
Instead, use ifeq to check if C is 0 or 1.

Check that `make C=0` does not invoke sprase.

Fixes f884bfe684f ("mmc-utils: Make functions static for local scope enforcement")

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
Changes from v1:
- added signature
- add test line to enphasize it is not a revert.

 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Avri Altman March 2, 2025, 7:30 a.m. UTC | #1
Ping.

Thanks,
Avri

> > sparse would always be invoked, since `ifdef C` is always true afet `C ?= xx`.
> > Instead, use ifeq to check if C is 0 or 1.
> >
> > Check that `make C=0` does not invoke sprase.
> >
> > Fixes f884bfe684f ("mmc-utils: Make functions static for local scope
> > enforcement")
> Nit sha1 should be 12 characters.
> 
> >
> > Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
> Reviewed-by: Avri Altman <avri.altman@wdc.com>
> 
> > ---
> > Changes from v1:
> > - added signature
> > - add test line to enphasize it is not a revert.
> >
> >  Makefile | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 06ae0f7..c0284bb 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -27,14 +27,14 @@ progs = mmc
> >
> >  # make C=1 to enable sparse - default  C ?= 1 -ifdef C
> > +ifeq "$(C)" "1"
> >         check = sparse $(CHECKFLAGS) $(AM_CFLAGS)  endif
> >
> >  all: $(progs)
> >
> >  .c.o:
> > -ifdef C
> > +ifeq "$(C)" "1"
> >         $(check) $<
> >  endif
> >         $(CC) $(CPPFLAGS) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
> > --
> > 2.48.1.362.g079036d154-goog
>
Avri Altman March 9, 2025, 6:52 a.m. UTC | #2
> Ping.
And a second one.

Ulf, there are couple of fixes waiting to be pulled.
Those are blocking some new stuff waiting for a while.
Would appreciate your help.

Thanks,
Avri

> 
> Thanks,
> Avri
> 
> > > sparse would always be invoked, since `ifdef C` is always true afet `C ?= xx`.
> > > Instead, use ifeq to check if C is 0 or 1.
> > >
> > > Check that `make C=0` does not invoke sprase.
> > >
> > > Fixes f884bfe684f ("mmc-utils: Make functions static for local scope
> > > enforcement")
> > Nit sha1 should be 12 characters.
> >
> > >
> > > Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
> > Reviewed-by: Avri Altman <avri.altman@wdc.com>
> >
> > > ---
> > > Changes from v1:
> > > - added signature
> > > - add test line to enphasize it is not a revert.
> > >
> > >  Makefile | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/Makefile b/Makefile
> > > index 06ae0f7..c0284bb 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -27,14 +27,14 @@ progs = mmc
> > >
> > >  # make C=1 to enable sparse - default  C ?= 1 -ifdef C
> > > +ifeq "$(C)" "1"
> > >         check = sparse $(CHECKFLAGS) $(AM_CFLAGS)  endif
> > >
> > >  all: $(progs)
> > >
> > >  .c.o:
> > > -ifdef C
> > > +ifeq "$(C)" "1"
> > >         $(check) $<
> > >  endif
> > >         $(CC) $(CPPFLAGS) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
> > > --
> > > 2.48.1.362.g079036d154-goog
> >
Ulf Hansson March 12, 2025, 11:40 a.m. UTC | #3
On Mon, 3 Feb 2025 at 18:40, Avri Altman <Avri.Altman@wdc.com> wrote:
>
> > sparse would always be invoked, since `ifdef C` is always true afet `C ?= xx`.
> > Instead, use ifeq to check if C is 0 or 1.
> >
> > Check that `make C=0` does not invoke sprase.
> >
> > Fixes f884bfe684f ("mmc-utils: Make functions static for local scope
> > enforcement")
> Nit sha1 should be 12 characters.
>
> >
> > Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
> Reviewed-by: Avri Altman <avri.altman@wdc.com>

Applied to mmc-utils, thanks!

Kind regards
Uffe


>
> > ---
> > Changes from v1:
> > - added signature
> > - add test line to enphasize it is not a revert.
> >
> >  Makefile | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 06ae0f7..c0284bb 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -27,14 +27,14 @@ progs = mmc
> >
> >  # make C=1 to enable sparse - default
> >  C ?= 1
> > -ifdef C
> > +ifeq "$(C)" "1"
> >         check = sparse $(CHECKFLAGS) $(AM_CFLAGS)  endif
> >
> >  all: $(progs)
> >
> >  .c.o:
> > -ifdef C
> > +ifeq "$(C)" "1"
> >         $(check) $<
> >  endif
> >         $(CC) $(CPPFLAGS) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
> > --
> > 2.48.1.362.g079036d154-goog
>
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 06ae0f7..c0284bb 100644
--- a/Makefile
+++ b/Makefile
@@ -27,14 +27,14 @@  progs = mmc
 
 # make C=1 to enable sparse - default
 C ?= 1
-ifdef C
+ifeq "$(C)" "1"
 	check = sparse $(CHECKFLAGS) $(AM_CFLAGS)
 endif
 
 all: $(progs)
 
 .c.o:
-ifdef C
+ifeq "$(C)" "1"
 	$(check) $<
 endif
 	$(CC) $(CPPFLAGS) $(CFLAGS) $(DEPFLAGS) -c $< -o $@