All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] tools: adopt --std=gnu99 where C99 comments are needed
@ 2018-05-14 11:53 Philipp Tomsich
  2018-05-14 12:07 ` Dr. Philipp Tomsich
  2018-05-14 12:52 ` Tom Rini
  0 siblings, 2 replies; 4+ messages in thread
From: Philipp Tomsich @ 2018-05-14 11:53 UTC (permalink / raw)
  To: u-boot

Following the conversion of the SPDX license tags, a number of files
compiled with -pedantic now generate warnings similar to the following
for using C99-style '//' comments in ISO C90 code:

  tools/gen_eth_addr.c:1:1: warning: C++ style comments are not allowed in ISO C90
   // SPDX-License-Identifier: GPL-2.0+
   ^

The SPDX comment-style change means that these files have adopted C99,
so we change the language-standard to --std=gnu99 to let the compiler
know this.

References: commit 83d290c56fab ("SPDX: Convert all of our single license tags to Linux Kernel style")
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
---

 tools/Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/Makefile b/tools/Makefile
index 5dd33ed..079d902 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -38,11 +38,11 @@ hostprogs-$(CONFIG_BUILD_ENVCRC) += envcrc
 envcrc-objs := envcrc.o lib/crc32.o env/embedded.o lib/sha1.o
 
 hostprogs-$(CONFIG_CMD_NET) += gen_eth_addr
-HOSTCFLAGS_gen_eth_addr.o := -pedantic
+HOSTCFLAGS_gen_eth_addr.o := --std=gnu99 -pedantic
 
 hostprogs-$(CONFIG_CMD_NET) += gen_ethaddr_crc
 gen_ethaddr_crc-objs := gen_ethaddr_crc.o lib/crc8.o
-HOSTCFLAGS_gen_ethaddr_crc.o := -pedantic
+HOSTCFLAGS_gen_ethaddr_crc.o := --std=gnu99 -pedantic
 
 hostprogs-$(CONFIG_CMD_LOADS) += img2srec
 HOSTCFLAGS_img2srec.o := -pedantic
@@ -200,10 +200,10 @@ hostprogs-$(CONFIG_MIPS) += mips-relocs
 # that won't build on some weird host compiler -- though there are lots of
 # exceptions for files that aren't complaint.
 HOSTCFLAGS_crc32.o := -pedantic
-HOSTCFLAGS_crc8.o := -pedantic
+HOSTCFLAGS_crc8.o := --std=gnu99 -pedantic
 HOSTCFLAGS_md5.o := -pedantic
-HOSTCFLAGS_sha1.o := -pedantic
-HOSTCFLAGS_sha256.o := -pedantic
+HOSTCFLAGS_sha1.o := --std=gnu99 -pedantic
+HOSTCFLAGS_sha256.o := --std=gnu99 -pedantic
 
 quiet_cmd_wrap = WRAP    $@
 cmd_wrap = echo "\#include <../$(patsubst $(obj)/%,%,$@)>" >$@
-- 
2.1.4

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

* [U-Boot] [PATCH] tools: adopt --std=gnu99 where C99 comments are needed
  2018-05-14 11:53 [U-Boot] [PATCH] tools: adopt --std=gnu99 where C99 comments are needed Philipp Tomsich
@ 2018-05-14 12:07 ` Dr. Philipp Tomsich
  2018-05-14 20:50   ` Tom Rini
  2018-05-14 12:52 ` Tom Rini
  1 sibling, 1 reply; 4+ messages in thread
From: Dr. Philipp Tomsich @ 2018-05-14 12:07 UTC (permalink / raw)
  To: u-boot

While it’s not directly related to this patch, we should clearly state that
the U-Boot code base (with the possible exception of the tools/ directory,
which I have started touching here) has _implicitly_ moved to GNU11 
(yes, even newer than C99), when be upgraded beyond GCC 5.

For reference, see the "Default standard is now GNU11” section at 
	https://gcc.gnu.org/gcc-5/porting_to.html

Do we want to
(a)	document this somewhere (which file in doc/ would be appropriate?)
(b)	explicitly set the “--std=“ flag to make sure that people (and their compilers)
	are aware of this?

Thanks,
Philipp.

> On 14 May 2018, at 13:53, Philipp Tomsich <philipp.tomsich@theobroma-systems.com> wrote:
> 
> Following the conversion of the SPDX license tags, a number of files
> compiled with -pedantic now generate warnings similar to the following
> for using C99-style '//' comments in ISO C90 code:
> 
>  tools/gen_eth_addr.c:1:1: warning: C++ style comments are not allowed in ISO C90
>   // SPDX-License-Identifier: GPL-2.0+
>   ^
> 
> The SPDX comment-style change means that these files have adopted C99,
> so we change the language-standard to --std=gnu99 to let the compiler
> know this.
> 
> References: commit 83d290c56fab ("SPDX: Convert all of our single license tags to Linux Kernel style")
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
> tools/Makefile | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/Makefile b/tools/Makefile
> index 5dd33ed..079d902 100644
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -38,11 +38,11 @@ hostprogs-$(CONFIG_BUILD_ENVCRC) += envcrc
> envcrc-objs := envcrc.o lib/crc32.o env/embedded.o lib/sha1.o
> 
> hostprogs-$(CONFIG_CMD_NET) += gen_eth_addr
> -HOSTCFLAGS_gen_eth_addr.o := -pedantic
> +HOSTCFLAGS_gen_eth_addr.o := --std=gnu99 -pedantic
> 
> hostprogs-$(CONFIG_CMD_NET) += gen_ethaddr_crc
> gen_ethaddr_crc-objs := gen_ethaddr_crc.o lib/crc8.o
> -HOSTCFLAGS_gen_ethaddr_crc.o := -pedantic
> +HOSTCFLAGS_gen_ethaddr_crc.o := --std=gnu99 -pedantic
> 
> hostprogs-$(CONFIG_CMD_LOADS) += img2srec
> HOSTCFLAGS_img2srec.o := -pedantic
> @@ -200,10 +200,10 @@ hostprogs-$(CONFIG_MIPS) += mips-relocs
> # that won't build on some weird host compiler -- though there are lots of
> # exceptions for files that aren't complaint.
> HOSTCFLAGS_crc32.o := -pedantic
> -HOSTCFLAGS_crc8.o := -pedantic
> +HOSTCFLAGS_crc8.o := --std=gnu99 -pedantic
> HOSTCFLAGS_md5.o := -pedantic
> -HOSTCFLAGS_sha1.o := -pedantic
> -HOSTCFLAGS_sha256.o := -pedantic
> +HOSTCFLAGS_sha1.o := --std=gnu99 -pedantic
> +HOSTCFLAGS_sha256.o := --std=gnu99 -pedantic
> 
> quiet_cmd_wrap = WRAP    $@
> cmd_wrap = echo "\#include <../$(patsubst $(obj)/%,%,$@)>" >$@
> -- 
> 2.1.4
> 

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

* [U-Boot] [PATCH] tools: adopt --std=gnu99 where C99 comments are needed
  2018-05-14 11:53 [U-Boot] [PATCH] tools: adopt --std=gnu99 where C99 comments are needed Philipp Tomsich
  2018-05-14 12:07 ` Dr. Philipp Tomsich
@ 2018-05-14 12:52 ` Tom Rini
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2018-05-14 12:52 UTC (permalink / raw)
  To: u-boot

On Mon, May 14, 2018 at 01:53:50PM +0200, Philipp Tomsich wrote:

> Following the conversion of the SPDX license tags, a number of files
> compiled with -pedantic now generate warnings similar to the following
> for using C99-style '//' comments in ISO C90 code:
> 
>   tools/gen_eth_addr.c:1:1: warning: C++ style comments are not allowed in ISO C90
>    // SPDX-License-Identifier: GPL-2.0+
>    ^
> 
> The SPDX comment-style change means that these files have adopted C99,
> so we change the language-standard to --std=gnu99 to let the compiler
> know this.
> 
> References: commit 83d290c56fab ("SPDX: Convert all of our single license tags to Linux Kernel style")
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
>  tools/Makefile | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/Makefile b/tools/Makefile
> index 5dd33ed..079d902 100644
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -38,11 +38,11 @@ hostprogs-$(CONFIG_BUILD_ENVCRC) += envcrc
>  envcrc-objs := envcrc.o lib/crc32.o env/embedded.o lib/sha1.o
>  
>  hostprogs-$(CONFIG_CMD_NET) += gen_eth_addr
> -HOSTCFLAGS_gen_eth_addr.o := -pedantic
> +HOSTCFLAGS_gen_eth_addr.o := --std=gnu99 -pedantic
>  
>  hostprogs-$(CONFIG_CMD_NET) += gen_ethaddr_crc
>  gen_ethaddr_crc-objs := gen_ethaddr_crc.o lib/crc8.o
> -HOSTCFLAGS_gen_ethaddr_crc.o := -pedantic
> +HOSTCFLAGS_gen_ethaddr_crc.o := --std=gnu99 -pedantic
>  
>  hostprogs-$(CONFIG_CMD_LOADS) += img2srec
>  HOSTCFLAGS_img2srec.o := -pedantic

The above highlights an interesting problem.  We have a lot of files in
tools/ without SPDX tags, and this is because in a number of cases
they're not easily tagable.  Setting aside that bit of un-fun legal
work, can we just add --std=gnu99 to HOSTCFLAGS in all cases, say around
where we define the wrap command in that Makefile?  All of the cases
without a tag should get fixed at some point and this will future proof
us.  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180514/597bf029/attachment.sig>

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

* [U-Boot] [PATCH] tools: adopt --std=gnu99 where C99 comments are needed
  2018-05-14 12:07 ` Dr. Philipp Tomsich
@ 2018-05-14 20:50   ` Tom Rini
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2018-05-14 20:50 UTC (permalink / raw)
  To: u-boot

On Mon, May 14, 2018 at 02:07:27PM +0200, Dr. Philipp Tomsich wrote:

> While it’s not directly related to this patch, we should clearly state that
> the U-Boot code base (with the possible exception of the tools/ directory,
> which I have started touching here) has _implicitly_ moved to GNU11 
> (yes, even newer than C99), when be upgraded beyond GCC 5.
> 
> For reference, see the "Default standard is now GNU11” section at 
> 	https://gcc.gnu.org/gcc-5/porting_to.html
> 
> Do we want to
> (a)	document this somewhere (which file in doc/ would be appropriate?)
> (b)	explicitly set the “--std=“ flag to make sure that people (and their compilers)
> 	are aware of this?

For the record, I don't see anything here as a problem.  I did half
suggest, and did reviewed-by just spelling out GNU11.  So long as that
isn't a problem for clang-5, I don't think this is a problem.  The "$X
is a warning" are things we've had to long since clean up.  This is also
not me suggesting that we make use of any particular new language
features.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180514/3a7e8dee/attachment.sig>

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

end of thread, other threads:[~2018-05-14 20:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-14 11:53 [U-Boot] [PATCH] tools: adopt --std=gnu99 where C99 comments are needed Philipp Tomsich
2018-05-14 12:07 ` Dr. Philipp Tomsich
2018-05-14 20:50   ` Tom Rini
2018-05-14 12:52 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.