Re: [coreboot] [RFC] Setting C99 by default

2016-11-28 Thread Nico Huber
On 27.11.2016 23:07, Paul Menzel via coreboot wrote:
> Dear coreboot folks,
> 
> 
> Using GCC 4.9.2 coreboot fails to build for certain boards, whose code
> uses ‘for’ loop initial declarations.
> 
> ```
> $ gcc --version
> gcc (Debian 4.9.2-10) 4.9.2
> […]
> $ make # lenovo/x60 with native graphics initialization
> […]
> CC ramstage/northbridge/intel/i945/gma.o
> src/northbridge/intel/i945/gma.c: In function 'probe_edid':
> src/northbridge/intel/i945/gma.c:570:2: error: 'for' loop initial 
> declarations are only allowed in C99 or C11 mode
>   for (int i = 0; i < 8; i++) {
>   ^
> src/northbridge/intel/i945/gma.c:570:2: note: use option -std=c99, 
> -std=gnu99, -std=c11 or -std=gnu11 to compile your code
> Makefile:316: recipe for target 'build/ramstage/northbridge/intel/i945/gma.o' 
> failed
> make: *** [build/ramstage/northbridge/intel/i945/gma.o] Error 1
> ```
> 
> As Linux has switched to C99 in version 3.18, I suggest that coreboot
> also explicitly sets that in the Makefiles, so that code can easily be
> copied and so that there is no dependency on the compiler default.

Please don't use the c-word too much. Code can be written, it doesn't
have to be copied.

This is just the wrong reason to base this decision on. What code should
be copied? coreboot code to Linux? very unlikely. Linux code to core-
boot? even if it would sneak through a review, it wouldn't be asked to
much to make it compilable.

Btw. Linux uses neither C99 nor C89. They use GNU89. For the only reason
that they didn't clean up their codebase yet.

Nico

> 
> Are there any objections?
> 
> 
> Thanks,
> 
> Paul
> 
> 
> [1] https://review.coreboot.org/17623/
> 
> 
> 


-- 
coreboot mailing list: coreboot@coreboot.org
https://www.coreboot.org/mailman/listinfo/coreboot


Re: [coreboot] [RFC] Setting C99 by default

2016-11-27 Thread ron minnich
Seems reasonable, but on Harvey recently we went with c11. Any reason not
to do that instead?

On Sun, Nov 27, 2016 at 2:09 PM Paul Menzel via coreboot <
coreboot@coreboot.org> wrote:

> Dear coreboot folks,
>
>
> Using GCC 4.9.2 coreboot fails to build for certain boards, whose code
> uses ‘for’ loop initial declarations.
>
> ```
> $ gcc --version
> gcc (Debian 4.9.2-10) 4.9.2
> […]
> $ make # lenovo/x60 with native graphics initialization
> […]
> CC ramstage/northbridge/intel/i945/gma.o
> src/northbridge/intel/i945/gma.c: In function 'probe_edid':
> src/northbridge/intel/i945/gma.c:570:2: error: 'for' loop initial
> declarations are only allowed in C99 or C11 mode
>   for (int i = 0; i < 8; i++) {
>   ^
> src/northbridge/intel/i945/gma.c:570:2: note: use option -std=c99,
> -std=gnu99, -std=c11 or -std=gnu11 to compile your code
> Makefile:316: recipe for target
> 'build/ramstage/northbridge/intel/i945/gma.o' failed
> make: *** [build/ramstage/northbridge/intel/i945/gma.o] Error 1
> ```
>
> As Linux has switched to C99 in version 3.18, I suggest that coreboot
> also explicitly sets that in the Makefiles, so that code can easily be
> copied and so that there is no dependency on the compiler default.
>
> Are there any objections?
>
>
> Thanks,
>
> Paul
>
>
> [1] https://review.coreboot.org/17623/--
> coreboot mailing list: coreboot@coreboot.org
> https://www.coreboot.org/mailman/listinfo/coreboot
-- 
coreboot mailing list: coreboot@coreboot.org
https://www.coreboot.org/mailman/listinfo/coreboot

[coreboot] [RFC] Setting C99 by default

2016-11-27 Thread Paul Menzel via coreboot
Dear coreboot folks,


Using GCC 4.9.2 coreboot fails to build for certain boards, whose code
uses ‘for’ loop initial declarations.

```
$ gcc --version
gcc (Debian 4.9.2-10) 4.9.2
[…]
$ make # lenovo/x60 with native graphics initialization
[…]
CC ramstage/northbridge/intel/i945/gma.o
src/northbridge/intel/i945/gma.c: In function 'probe_edid':
src/northbridge/intel/i945/gma.c:570:2: error: 'for' loop initial declarations 
are only allowed in C99 or C11 mode
  for (int i = 0; i < 8; i++) {
  ^
src/northbridge/intel/i945/gma.c:570:2: note: use option -std=c99, -std=gnu99, 
-std=c11 or -std=gnu11 to compile your code
Makefile:316: recipe for target 'build/ramstage/northbridge/intel/i945/gma.o' 
failed
make: *** [build/ramstage/northbridge/intel/i945/gma.o] Error 1
```

As Linux has switched to C99 in version 3.18, I suggest that coreboot
also explicitly sets that in the Makefiles, so that code can easily be
copied and so that there is no dependency on the compiler default.

Are there any objections?


Thanks,

Paul


[1] https://review.coreboot.org/17623/

signature.asc
Description: This is a digitally signed message part
-- 
coreboot mailing list: coreboot@coreboot.org
https://www.coreboot.org/mailman/listinfo/coreboot