public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] config.mk: Add -Wundef to CFLAGS
@ 2013-07-30  2:57 Masahiro Yamada
  2013-07-30 12:07 ` Albert ARIBAUD
  0 siblings, 1 reply; 8+ messages in thread
From: Masahiro Yamada @ 2013-07-30  2:57 UTC (permalink / raw)
  To: u-boot

In U-boot source, some '#if' directives evaluate
undefined identifiers.

To find and fix them, this commit adds -Wundef to CFLAGS.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---
 config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.mk b/config.mk
index f71e145..7a92ae3 100644
--- a/config.mk
+++ b/config.mk
@@ -259,7 +259,7 @@ CPPFLAGS += -I$(TOPDIR)/include
 CPPFLAGS += -fno-builtin -ffreestanding -nostdinc	\
 	-isystem $(gccincdir) -pipe $(PLATFORM_CPPFLAGS)
 
-CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes
+CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wundef
 
 ifdef BUILD_TAG
 CFLAGS += -DBUILD_TAG='"$(BUILD_TAG)"'
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] config.mk: Add -Wundef to CFLAGS
  2013-07-30  2:57 [U-Boot] [PATCH] config.mk: Add -Wundef to CFLAGS Masahiro Yamada
@ 2013-07-30 12:07 ` Albert ARIBAUD
  2013-07-31  2:45   ` Masahiro Yamada
  0 siblings, 1 reply; 8+ messages in thread
From: Albert ARIBAUD @ 2013-07-30 12:07 UTC (permalink / raw)
  To: u-boot

Hi Masahiro,

On Tue, 30 Jul 2013 11:57:05 +0900, Masahiro Yamada
<yamada.m@jp.panasonic.com> wrote:

> In U-boot source, some '#if' directives evaluate
> undefined identifiers.
> 
> To find and fix them, this commit adds -Wundef to CFLAGS.
> 
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> ---
>  config.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/config.mk b/config.mk
> index f71e145..7a92ae3 100644
> --- a/config.mk
> +++ b/config.mk
> @@ -259,7 +259,7 @@ CPPFLAGS += -I$(TOPDIR)/include
>  CPPFLAGS += -fno-builtin -ffreestanding -nostdinc	\
>  	-isystem $(gccincdir) -pipe $(PLATFORM_CPPFLAGS)
>  
> -CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes
> +CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wundef
>  
>  ifdef BUILD_TAG
>  CFLAGS += -DBUILD_TAG='"$(BUILD_TAG)"'

Will the patch cause some targets to break? If so, then I personally
would prefer that fixes be provided for at least the trivial cases.

Amicalement,
-- 
Albert.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] config.mk: Add -Wundef to CFLAGS
  2013-07-30 12:07 ` Albert ARIBAUD
@ 2013-07-31  2:45   ` Masahiro Yamada
  2013-07-31  7:26     ` Albert ARIBAUD
  0 siblings, 1 reply; 8+ messages in thread
From: Masahiro Yamada @ 2013-07-31  2:45 UTC (permalink / raw)
  To: u-boot

Hello Albert

> Will the patch cause some targets to break? 

I don't think so
because -Wundef option just prints warnings.


GCC manual says:
-Wundef
Warn if an undefined identifier is evaluated in an ?#if? directive.



After applying this patch,
I noticed warnings like follows:

include/common.h:240:11: warning: "CONFIG_ENV_ADDR" is not defined [-Wundef]
include/common.h:240:46: warning: "CONFIG_SYS_MONITOR_BASE" is not defined [-Wundef]
include/common.h:241:3: warning: "CONFIG_ENV_ADDR" is not defined [-Wundef]
include/common.h:241:23: warning: "CONFIG_SYS_MONITOR_BASE" is not defined [-Wundef]
include/common.h:241:49: warning: "CONFIG_SYS_MONITOR_LEN" is not defined [-Wundef]


If this patch is applied soon, we have enough time to fix warnings 
before u-boot-2013.10 release.

If I have time, I'd like to make effort to eliminate such warnings.
Of course, patches from other contributers are very welcome.


Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] config.mk: Add -Wundef to CFLAGS
  2013-07-31  2:45   ` Masahiro Yamada
@ 2013-07-31  7:26     ` Albert ARIBAUD
  2013-08-21  4:33       ` Masahiro Yamada
  0 siblings, 1 reply; 8+ messages in thread
From: Albert ARIBAUD @ 2013-07-31  7:26 UTC (permalink / raw)
  To: u-boot

Hi Masahiro,

On Wed, 31 Jul 2013 11:45:18 +0900, Masahiro Yamada
<yamada.m@jp.panasonic.com> wrote:

> Hello Albert
> 
> > Will the patch cause some targets to break? 
> 
> I don't think so
> because -Wundef option just prints warnings.
> 
> 
> GCC manual says:
> -Wundef
> Warn if an undefined identifier is evaluated in an ?#if? directive.
> 
> 
> 
> After applying this patch,
> I noticed warnings like follows:
> 
> include/common.h:240:11: warning: "CONFIG_ENV_ADDR" is not defined [-Wundef]
> include/common.h:240:46: warning: "CONFIG_SYS_MONITOR_BASE" is not defined [-Wundef]
> include/common.h:241:3: warning: "CONFIG_ENV_ADDR" is not defined [-Wundef]
> include/common.h:241:23: warning: "CONFIG_SYS_MONITOR_BASE" is not defined [-Wundef]
> include/common.h:241:49: warning: "CONFIG_SYS_MONITOR_LEN" is not defined [-Wundef]
> 
> 
> If this patch is applied soon, we have enough time to fix warnings 
> before u-boot-2013.10 release.
> 
> If I have time, I'd like to make effort to eliminate such warnings.
> Of course, patches from other contributers are very welcome.

I U-Boot we have a policy that "warnings are errors", so yes, this
change breaks some boards.

I would indeed ask that any warnings this swtich causes to appear
should be fixed.

However, the problem is you're doing a change across *all
architectures* but will most probably only test it for a few, if not
only one.

This means your patch will require *all* custodians to verify that
everything keeps building fine for *their* architecture.

[ $ sudo wdenk || echo "Oh well." ]

Therefore I ask:

- that this patch be submitted along fixes to build failures it
  causes, as a proper patch series, by a single individual, or
  collected by someone in an officially created git repo or branch;

- that the series be tested before submission for at least one target
  of each architecture (not necessarily by a single person, though:
  if collected in a repo or branch, testing would occur when people
  submit individual fixes, and the fix would only be accepted if such
  testing has been done);

- that whenever a version of the series is submitted, all architecture
  custodians be CC:ed and asked explicitly to build the series for the
  whole of their architecture (for ARM, you can Cc: me only, as I also
  build all the other ARM trees);

- that the custodians report to the submitter all build failures, and
  that the submitter fix and tests for any such report (or again, gets
  it tested by someone else)

[ exit ]

I'd love to see this warning in; but I'd hate to see uncoordinated,
loosely inter-related, patches from various individuals ending up as
noise. Let's make this in an organized fashion.

> Best Regards
> Masahiro Yamada

Amicalement,
-- 
Albert.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] config.mk: Add -Wundef to CFLAGS
  2013-07-31  7:26     ` Albert ARIBAUD
@ 2013-08-21  4:33       ` Masahiro Yamada
  2013-10-02 19:27         ` Albert ARIBAUD
  0 siblings, 1 reply; 8+ messages in thread
From: Masahiro Yamada @ 2013-08-21  4:33 UTC (permalink / raw)
  To: u-boot

Hello, Albert and U-Boot developers.


The current status of this patch is Changes Requested.

I love -Wundef option to be in, but it looks like
difficult for me to post the version 2.


The first choice to meet Albert's requirement is

> Therefore I ask:
> 
> - that this patch be submitted along fixes to build failures it
>   causes, as a proper patch series, by a single individual,

Sorry, I cannot do this because:

I am not familiar with architectures other than ARM.
I understand only a few devices.
To fix warnings in a correct way, a close look is often needed,
but I cannot cover the whole code in the U-Boot tree.

If possible, could anyone take over this task?



The other option is

>   collected by someone in an officially created git repo or branch;

OK, I can do this.
But I am not sure this will go well.

Even if I create a new repo u-boot-wundef,
how many people will pay attention to this repository?

Most of users/developers track upstream repos
where -Wundef warnings are never displayed.

This means no one will have the motivation to fix the warnings.



If this patch is desired, in which way should we continue?
Comments are welcome.


Best Regards,
Masahiro Yamada

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] config.mk: Add -Wundef to CFLAGS
  2013-08-21  4:33       ` Masahiro Yamada
@ 2013-10-02 19:27         ` Albert ARIBAUD
  2013-10-03 23:49           ` Simon Glass
  0 siblings, 1 reply; 8+ messages in thread
From: Albert ARIBAUD @ 2013-10-02 19:27 UTC (permalink / raw)
  To: u-boot

Hi Masahiro,

On Wed, 21 Aug 2013 13:33:19 +0900, Masahiro Yamada
<yamada.m@jp.panasonic.com> wrote:

> Hello, Albert and U-Boot developers.
> 
> 
> The current status of this patch is Changes Requested.
> 
> I love -Wundef option to be in, but it looks like
> difficult for me to post the version 2.
> 
> 
> The first choice to meet Albert's requirement is
> 
> > Therefore I ask:
> > 
> > - that this patch be submitted along fixes to build failures it
> >   causes, as a proper patch series, by a single individual,
> 
> Sorry, I cannot do this because:
> 
> I am not familiar with architectures other than ARM.
> I understand only a few devices.
> To fix warnings in a correct way, a close look is often needed,
> but I cannot cover the whole code in the U-Boot tree.
> 
> If possible, could anyone take over this task?
> 
> 
> 
> The other option is
> 
> >   collected by someone in an officially created git repo or branch;
> 
> OK, I can do this.
> But I am not sure this will go well.
> 
> Even if I create a new repo u-boot-wundef,
> how many people will pay attention to this repository?
> 
> Most of users/developers track upstream repos
> where -Wundef warnings are never displayed.
> 
> This means no one will have the motivation to fix the warnings.
> 
> 
> 
> If this patch is desired, in which way should we continue?
> Comments are welcome.

Sorry not to have followed up earlier.

As I said, I want fixes for trivial cases -- cases where, for instance,
a macro is used in an #if which has absolutely *no* definition in the
whole codebase. I do not want fixes for all cases.

OTOH, to find out which failures would be trivial to fix and which ones
would not, you'd have to go through all of them, which could be
time-consuming, depending on the number of targets.

I thus suggest we use the typical U-Boot strategy: right at the
beginning of the merge period, we apply the -Wundef patch onto all
repos (or on the main repo and then pulled into others) and then wait
for screams.

Screams should come fst from custodians, who routinely build for all
targets of their assigned architecture. They will see which boards fail
due to undefined macros and will report those failures on the list,
copying the board maintainers (or subsystem owners if the issue is not
board-specific.

All boards not fixed before merge window closure release will be
declared dying; all those not fixed before 2014.01 will be declared
dead, and orphaned and put in the scrapyard (and then, people who want
them back can always resurrect *and fix* them).

Subsystems... will have to be fixed some way or other.

Of course, anyone with an interest can spontaneously provide fixes for
boards or subsystems affected.

Adding Tom and Wolfgang for advice, but of course comments are welcome
from everyone.

> Best Regards,
> Masahiro Yamada

Amicalement,
-- 
Albert.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] config.mk: Add -Wundef to CFLAGS
  2013-10-02 19:27         ` Albert ARIBAUD
@ 2013-10-03 23:49           ` Simon Glass
  2013-10-05  7:04             ` Albert ARIBAUD
  0 siblings, 1 reply; 8+ messages in thread
From: Simon Glass @ 2013-10-03 23:49 UTC (permalink / raw)
  To: u-boot

Hi,


On Wed, Oct 2, 2013 at 1:27 PM, Albert ARIBAUD <albert.u.boot@aribaud.net>wrote:

> Hi Masahiro,
>
> On Wed, 21 Aug 2013 13:33:19 +0900, Masahiro Yamada
> <yamada.m@jp.panasonic.com> wrote:
>
> > Hello, Albert and U-Boot developers.
> >
> >
> > The current status of this patch is Changes Requested.
> >
> > I love -Wundef option to be in, but it looks like
> > difficult for me to post the version 2.
> >
> >
> > The first choice to meet Albert's requirement is
> >
> > > Therefore I ask:
> > >
> > > - that this patch be submitted along fixes to build failures it
> > >   causes, as a proper patch series, by a single individual,
> >
> > Sorry, I cannot do this because:
> >
> > I am not familiar with architectures other than ARM.
> > I understand only a few devices.
> > To fix warnings in a correct way, a close look is often needed,
> > but I cannot cover the whole code in the U-Boot tree.
> >
> > If possible, could anyone take over this task?
> >
> >
> >
> > The other option is
> >
> > >   collected by someone in an officially created git repo or branch;
> >
> > OK, I can do this.
> > But I am not sure this will go well.
> >
> > Even if I create a new repo u-boot-wundef,
> > how many people will pay attention to this repository?
> >
> > Most of users/developers track upstream repos
> > where -Wundef warnings are never displayed.
> >
> > This means no one will have the motivation to fix the warnings.
> >
> >
> >
> > If this patch is desired, in which way should we continue?
> > Comments are welcome.
>
> Sorry not to have followed up earlier.
>
> As I said, I want fixes for trivial cases -- cases where, for instance,
> a macro is used in an #if which has absolutely *no* definition in the
> whole codebase. I do not want fixes for all cases.
>
> OTOH, to find out which failures would be trivial to fix and which ones
> would not, you'd have to go through all of them, which could be
> time-consuming, depending on the number of targets.
>
> I thus suggest we use the typical U-Boot strategy: right at the
> beginning of the merge period, we apply the -Wundef patch onto all
> repos (or on the main repo and then pulled into others) and then wait
> for screams.
>
> Screams should come fst from custodians, who routinely build for all
> targets of their assigned architecture. They will see which boards fail
> due to undefined macros and will report those failures on the list,
> copying the board maintainers (or subsystem owners if the issue is not
> board-specific.
>
> All boards not fixed before merge window closure release will be
> declared dying; all those not fixed before 2014.01 will be declared
> dead, and orphaned and put in the scrapyard (and then, people who want
> them back can always resurrect *and fix* them).
>
> Subsystems... will have to be fixed some way or other.
>
> Of course, anyone with an interest can spontaneously provide fixes for
> boards or subsystems affected.
>
> Adding Tom and Wolfgang for advice, but of course comments are welcome
> from everyone.
>

Breaking a board by introducing a warning is bad, I don't think we can do
that.

But fixing common.h would be easy enough at least.

Can you run buildman on all boards and see how many files generate warnings?

Regards,
Simon


>
> > Best Regards,
> > Masahiro Yamada
>
> Amicalement,
> --
> Albert.
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] config.mk: Add -Wundef to CFLAGS
  2013-10-03 23:49           ` Simon Glass
@ 2013-10-05  7:04             ` Albert ARIBAUD
  0 siblings, 0 replies; 8+ messages in thread
From: Albert ARIBAUD @ 2013-10-05  7:04 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Thu, 3 Oct 2013 17:49:23 -0600, Simon Glass <sjg@chromium.org> wrote:

> Hi,
> 
> 
> On Wed, Oct 2, 2013 at 1:27 PM, Albert ARIBAUD <albert.u.boot@aribaud.net>wrote:
> 
> > Hi Masahiro,
> >
> > On Wed, 21 Aug 2013 13:33:19 +0900, Masahiro Yamada
> > <yamada.m@jp.panasonic.com> wrote:
> >
> > > Hello, Albert and U-Boot developers.
> > >
> > >
> > > The current status of this patch is Changes Requested.
> > >
> > > I love -Wundef option to be in, but it looks like
> > > difficult for me to post the version 2.
> > >
> > >
> > > The first choice to meet Albert's requirement is
> > >
> > > > Therefore I ask:
> > > >
> > > > - that this patch be submitted along fixes to build failures it
> > > >   causes, as a proper patch series, by a single individual,
> > >
> > > Sorry, I cannot do this because:
> > >
> > > I am not familiar with architectures other than ARM.
> > > I understand only a few devices.
> > > To fix warnings in a correct way, a close look is often needed,
> > > but I cannot cover the whole code in the U-Boot tree.
> > >
> > > If possible, could anyone take over this task?
> > >
> > >
> > >
> > > The other option is
> > >
> > > >   collected by someone in an officially created git repo or branch;
> > >
> > > OK, I can do this.
> > > But I am not sure this will go well.
> > >
> > > Even if I create a new repo u-boot-wundef,
> > > how many people will pay attention to this repository?
> > >
> > > Most of users/developers track upstream repos
> > > where -Wundef warnings are never displayed.
> > >
> > > This means no one will have the motivation to fix the warnings.
> > >
> > >
> > >
> > > If this patch is desired, in which way should we continue?
> > > Comments are welcome.
> >
> > Sorry not to have followed up earlier.
> >
> > As I said, I want fixes for trivial cases -- cases where, for instance,
> > a macro is used in an #if which has absolutely *no* definition in the
> > whole codebase. I do not want fixes for all cases.
> >
> > OTOH, to find out which failures would be trivial to fix and which ones
> > would not, you'd have to go through all of them, which could be
> > time-consuming, depending on the number of targets.
> >
> > I thus suggest we use the typical U-Boot strategy: right at the
> > beginning of the merge period, we apply the -Wundef patch onto all
> > repos (or on the main repo and then pulled into others) and then wait
> > for screams.
> >
> > Screams should come fst from custodians, who routinely build for all
> > targets of their assigned architecture. They will see which boards fail
> > due to undefined macros and will report those failures on the list,
> > copying the board maintainers (or subsystem owners if the issue is not
> > board-specific.
> >
> > All boards not fixed before merge window closure release will be
> > declared dying; all those not fixed before 2014.01 will be declared
> > dead, and orphaned and put in the scrapyard (and then, people who want
> > them back can always resurrect *and fix* them).
> >
> > Subsystems... will have to be fixed some way or other.
> >
> > Of course, anyone with an interest can spontaneously provide fixes for
> > boards or subsystems affected.
> >
> > Adding Tom and Wolfgang for advice, but of course comments are welcome
> > from everyone.
> >
> 
> Breaking a board by introducing a warning is bad, I don't think we can do
> that.

The idea *is* to break the board so that users or maintainers realize it
builds on an undefined macro preprocessor symbol -- or so that we
custodians realize no one is interested enough in that board to fix
it, which is a sign that it should be removed from the code base. We've
done such a thing before, actually, when a change required attention
from a lot of maintainers.

> But fixing common.h would be easy enough at least.

That can be done for cases where the missing symbol should indeed exist.
When it should not exist any more, nothing can fix it but removing the
code that uses the zombie symbol. And in both cases, breaking the build
with a warning is the best way to find and resolve the issue. 

> Can you run buildman on all boards and see how many filesgenerate warnings?

I assume this request was directed at Masahiro Yamada.

I second the request: if only a few boards are affected, then instead
of a system-wide change plus breaks, we could apply my first proposal,
that is, Masahiro asking maintainers for changes and coordinating
them in a branch, then a series.

> Regards,
> Simon

Amicalement,
-- 
Albert.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-10-05  7:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-30  2:57 [U-Boot] [PATCH] config.mk: Add -Wundef to CFLAGS Masahiro Yamada
2013-07-30 12:07 ` Albert ARIBAUD
2013-07-31  2:45   ` Masahiro Yamada
2013-07-31  7:26     ` Albert ARIBAUD
2013-08-21  4:33       ` Masahiro Yamada
2013-10-02 19:27         ` Albert ARIBAUD
2013-10-03 23:49           ` Simon Glass
2013-10-05  7:04             ` Albert ARIBAUD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox