diff mbox series

cgcc: fix definition of 'linux' macro

Message ID 18e4644b-7616-5d74-e298-4506372680b3@ramsayjones.plus.com (mailing list archive)
State Mainlined, archived
Headers show
Series cgcc: fix definition of 'linux' macro | expand

Commit Message

Ramsay Jones Nov. 28, 2019, 3:17 p.m. UTC
During a call to add_specs('linux'), cgcc adds several macro definitions
to the sparse command line. In particular, it provides the incorrect
definition: '-Dlinux=linux'.

This bug was introduced in commit 807f74466b (<no title>, 2004-08-13), while
moving some calls to add_pre_buffer() around in lib.c. This was then moved
out of sparse, into cgcc, by commit cf2bde63a6 (<no title>, 2004-10-05),
where the definition was copied verbatum.

Fix this macro definition to read '-Dlinux=1' instead.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
 cgcc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Luc Van Oostenryck Nov. 28, 2019, 8:36 p.m. UTC | #1
On Thu, Nov 28, 2019 at 03:17:59PM +0000, Ramsay Jones wrote:
> 
> During a call to add_specs('linux'), cgcc adds several macro definitions
> to the sparse command line. In particular, it provides the incorrect
> definition: '-Dlinux=linux'.
> 
> This bug was introduced in commit 807f74466b (<no title>, 2004-08-13), while
> moving some calls to add_pre_buffer() around in lib.c. This was then moved
> out of sparse, into cgcc, by commit cf2bde63a6 (<no title>, 2004-10-05),
> where the definition was copied verbatum.
> 
> Fix this macro definition to read '-Dlinux=1' instead.
> 
> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>

Thanks! Applied and pushed.

-- Luc
diff mbox series

Patch

diff --git a/cgcc b/cgcc
index 87f4fc3e..e6541d36 100755
--- a/cgcc
+++ b/cgcc
@@ -230,7 +230,7 @@  sub add_specs {
 	    ' -DNULL="((void *)0)"';
     } elsif ($spec eq 'linux') {
 	return &add_specs ('unix') .
-	    ' -D__linux__=1 -D__linux=1 -Dlinux=linux';
+	    ' -D__linux__=1 -D__linux=1 -Dlinux=1';
     } elsif ($spec eq 'gnu/kfreebsd') {
 	return &add_specs ('unix') .
 	    ' -D__FreeBSD_kernel__=1';