kernel.h Fix #warning message web address.
PATCH 1/1 kernel.h Fix #warning message web address.
Playing around with a printk program I noticed that the #warning message is incomplete(when using kernel headers for userspace):
gcc printk.c -o printk
In file included from printk.c:3:include/linux/kernel.h:733:2: warning: #warning Attempt to use kernel headers from user space, see http:
My guess for the web address not being displayed is "//" is treated as a comment. So after changing "http://" to "www." I get the web address.(using firefox with this address takes me right to the location). The warning looks like this:
In file included from printk.c:3:
warning: #warning Attempt to use kernel headers from user space, see www.kernelnewbies.org/KernelHeaders
--- include/linux/kernel.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/kernel.h +1 -1
@@ -730,7 +730,7 @@ extern int do_sysinfo(struct sysinfo *info);#ifndef __EXPORTED_HEADERS__#ifndef __KERNEL__ -#warning Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders +#warning Attempt to use kernel headers from user space, see www.kernelnewbies.org/KernelHeaders#endif /* __KERNEL__ */ #endif /* __EXPORTED_HEADERS__ */
Signature · 1 line
1.6.5.2.180.gc5b3e
Quoted 25 lines · Justin P. Mattock
Playing around with a printk program I noticed that the #warning message is incomplete(when using kernel headers for userspace):
gcc
printk.c-o printk
In file included from printk.c:3:include/linux/kernel.h:733:2: warning: #warning Attempt to use kernel headers from user space, see http:My guess for the web address not being displayed is "//" is treated as a comment. So after changing "http://" to "www." I get the web address.(using firefox with this address takes me right to the location). The warning looks like this:
In file included from printk.c:3:
warning: #warning Attempt to use kernel headers from user space, see www.kernelnewbies.org/KernelHeadersSigned-off-by Justin P. Mattock <[email protected]>--- include/linux/kernel.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)include/linux/kernel.h +0
-0
include/linux/kernel.h extern int do_sysinfo(struct sysinfo *info); · line 735
Quoted 7 lines
include/linux/kernel.h +1
-1@@ -730,7 +730,7 @@ extern int do_sysinfo(struct sysinfo *info);#ifndef __EXPORTED_HEADERS__#ifndef __KERNEL__ -#warning Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders +#warning Attempt to use kernel headers from user space, see www.kernelnewbies.org/KernelHeaders#endif /* __KERNEL__ */ #endif /* __EXPORTED_HEADERS__ */
Hehe, ugly. How about making it a single string? GCC preprocessor documentation suggests the same anyway ...
Neither #error' nor #warning' macro-expands its argument. Internal whitespace sequences are each replaced with a single space. The line must consist of complete tokens. It is wisest to make the argument of these directives be a single string constant; this avoids problems with apostrophes and the like.
Signature · 2 lines
Jiri Kosina SUSE Labs, Novell Inc.
Quoted 38 lines · Jiri Kosina
Quoted 25 lines · Justin P. Mattock
Playing around with a printk program I noticed that the #warning message is incomplete(when using kernel headers for userspace):
gcc
printk.c-o printk
In file included from printk.c:3:include/linux/kernel.h:733:2: warning: #warning Attempt to use kernel headers from user space, see http:My guess for the web address not being displayed is "//" is treated as a comment. So after changing "http://" to "www." I get the web address.(using firefox with this address takes me right to the location). The warning looks like this:
In file included from printk.c:3:
warning: #warning Attempt to use kernel headers from user space, see www.kernelnewbies.org/KernelHeadersSigned-off-by Justin P. Mattock<[email protected]>--- include/linux/kernel.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)include/linux/kernel.h +0
-0include/linux/kernel.h extern int do_sysinfo(struct sysinfo *info); · line 735
Quoted 7 lines
include/linux/kernel.h +1
-1@@ -730,7 +730,7 @@ extern int do_sysinfo(struct sysinfo *info);#ifndef __EXPORTED_HEADERS__#ifndef __KERNEL__ -#warning Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders +#warning Attempt to use kernel headers from user space, see www.kernelnewbies.org/KernelHeaders#endif /* __KERNEL__ */ #endif /* __EXPORTED_HEADERS__ */ Hehe, ugly. How about making it a single string? GCC preprocessor documentation suggests the same anyway ...
Quoted 6 lines
Neither
#error' nor#warning' macro-expands its argument. Internal whitespace sequences are each replaced with a single space. The line must consist of complete tokens. It is wisest to make the argument of these directives be a single string constant; this avoids problems with apostrophes and the like.
before the www. idea, I was thinking maybe sending the address to a file somewhere in documentation something in this area:
#warning Using kernel headers from user space, please see Documentation/*
but I still need to re-read what the above says, seems a bit technical..
Justin P. Mattock
Quoted 10 lines
Hehe, ugly. How about making it a single string? GCC preprocessor documentation suggests the same anyway ...
Neither
#error' nor#warning' macro-expands its argument. Internal whitespace sequences are each replaced with a single space. The line must consist of complete tokens. It is wisest to make the argument of these directives be a single string constant; this avoids problems with apostrophes and the like.
o.k. jiri, here is what I came up with, after re-reading and looking at other in the kernel(below).
From 45f24db45faa06aad01cfc62ff4b475380e5cb11 Mon Sep 17 00:00:00 2001
From: Justin P. Mattock <[email protected]>
Date: Wed, 30 Jun 2010 14:06:18 -0700
Subject: [PATCH]kernel.h Fix #warning message according to the GCC preprocessor docs.
received this #warning from a simple printk program and noticed the web
address is not showing up:
gcc printk.c -o printk
In file included from printk.c:3:include/linux/kernel.h:733:2: warning: #warning Attempt to use kernel headers from user space, see http:
after the changes the warning should just say:
#warning Attempt to use kernel headers from user space!
--- include/linux/kernel.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/kernel.h +1 -1
@@ -730,7 +730,7 @@ extern int do_sysinfo(struct sysinfo *info);#ifndef __EXPORTED_HEADERS__#ifndef __KERNEL__ -#warning Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders +#warning Attempt to use kernel headers from user space!#endif /* __KERNEL__ */ #endif /* __EXPORTED_HEADERS__ */
Signature · 8 lines
1.7.1.rc1.21.gf3bd6 now I'm wondering if there should be a lead to the documentation with this web address(seems grep is not finding anything that I might be able to use).or just leave as is, and let people connect-the-dots!! let me know.. Justin P. Mattock
Quoted 9 lines · On Wed, 30 Jun 2010 14:20:42 -0700 Justin P. Mattock wrote:
Quoted 9 lines
Hehe, ugly. How about making it a single string? GCC preprocessor documentation suggests the same anyway ...
Neither
#error' nor#warning' macro-expands its argument. Internal whitespace sequences are each replaced with a single space. The line must consist of complete tokens. It is wisest to make the argument of these directives be a single string constant; this avoids problems with apostrophes and the like.
Doesn't that mean just put double quotation marks around the entire message string??
Quoted 35 lines
o.k. jiri, here is what I came up with, after re-reading and looking at other in the kernel(below).
From
45f24db45faa06aad01cfc62ff4b475380e5cb11Mon Sep 17 00:00:00 2001
From: Justin P. Mattock <[email protected]>
Date: Wed, 30 Jun 2010 14:06:18 -0700
Subject: [PATCH]kernel.h Fix #warning message according to the GCC preprocessor docs.received this #warning from a simple printk program and noticed the web address is not showing up:
gccprintk.c-o printk
In file included from printk.c:3:include/linux/kernel.h:733:2: warning: #warning Attempt to use kernel headers from user space, see http:after the changes the warning should just say:
#warning Attempt to use kernel headers from user space!Signed-off-by Justin P. Mattock <[email protected]>--- include/linux/kernel.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)include/linux/kernel.h +0
-1@@ -730,7 +730,7 @@ extern int do_sysinfo(struct sysinfo *info);#ifndef __EXPORTED_HEADERS__#ifndef __KERNEL__ -#warning Attempt to use kernel headers from user space, see
Quoted 21 lines
http://kernelnewbies.org/KernelHeaders
+#warning Attempt to use kernel headers from user space!
#endif /*__KERNEL__*/
#endif /*__EXPORTED_HEADERS__*/Signature · 15 lines
1.7.1.rc1.21.gf3bd6 now I'm wondering if there should be a lead to the documentation with this web address(seems grep is not finding anything that I might be able to use).or just leave as is, and let people connect-the-dots!! let me know.. Justin P. Mattock -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
Quoted 6 lines · Randy Dunlap
Quoted 4 lines · On Wed, 30 Jun 2010 14:20:42 -0700 Justin P. Mattock wrote:
Quoted 4 lines
Hehe, ugly. How about making it a single string? GCC preprocessor documentation suggests the same anyway ...
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Neither
#error' nor#warning' macro-expands its argument. Internal whitespace sequences are each replaced with a single space. The line must consist of complete tokens. It is wisest to make the argument of these directives be a single string constant; this avoids problems with apostrophes and the like.Doesn't that mean just put double quotation marks around the entire message string??
didnt even notice that. but to answer your question your right. updated patch below.
Quoted 52 lines
Quoted 52 lines
o.k. jiri, here is what I came up with, after re-reading and looking at other in the kernel(below).
From
45f24db45faa06aad01cfc62ff4b475380e5cb11Mon Sep 17 00:00:00 2001
From: Justin P. Mattock<[email protected]>
Date: Wed, 30 Jun 2010 14:06:18 -0700
Subject: [PATCH]kernel.h Fix #warning message according to the GCC preprocessor docs.received this #warning from a simple printk program and noticed the web address is not showing up:
gccprintk.c-o printk
In file included from printk.c:3:include/linux/kernel.h:733:2: warning: #warning Attempt to use kernel headers from user space, see http:after the changes the warning should just say:
#warning Attempt to use kernel headers from user space!Signed-off-by Justin P. Mattock<[email protected]>--- include/linux/kernel.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)include/linux/kernel.h +0
-1@@ -730,7 +730,7 @@ extern int do_sysinfo(struct sysinfo *info);#ifndef __EXPORTED_HEADERS__#ifndef __KERNEL__ -#warning Attempt to use kernel headers from user space, seehttp://kernelnewbies.org/KernelHeaders
+#warning Attempt to use kernel headers from user space!#endif /* __KERNEL__ */ #endif /* __EXPORTED_HEADERS__ */--
1.7.1.rc1.21.gf3bd6now I'm wondering if there should be a lead to the documentation with this web address(seems grep is not finding anything that I might be able to use).or just leave as is, and let people connect-the-dots!!
let me know..
Quoted 12 lines
Quoted 6 lines
Justin P. Mattock
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/---
~Randy
*** Remember to useDocumentation/SubmitChecklistwhen testing your code ***
From 5e0b59283521c4b222c1131626e306752cd157f3 Mon Sep 17 00:00:00 2001
From: Justin P. Mattock <[email protected]>
Date: Wed, 30 Jun 2010 14:30:22 -0700
Subject: [PATCH]kernel.h Add quotation marks around the message so the web address is shown.
Add quotation marks around the message so the web address is shown. before:
gcc printk.c -o printk
In file included from printk.c:3:include/linux/kernel.h:733:2: warning: #warning Attempt to use kernel headers from user space, see http:
after:
gcc printk.c -o printk
In file included from printk.c:3:
warning: #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders"
--- include/linux/kernel.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/kernel.h +1 -1
@@ -730,7 +730,7 @@ extern int do_sysinfo(struct sysinfo *info);#ifndef __EXPORTED_HEADERS__#ifndef __KERNEL__ -#warning Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders +#warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders"#endif /* __KERNEL__ */ #endif /* __EXPORTED_HEADERS__ */
Signature · 6 lines
1.6.5.2.180.gc5b3e of the two whatever works best. Justin P. Mattock
Quoted 10 lines · On Wednesday 30 June 2010 23:20:42 Justin P. Mattock wrote:
Quoted 10 lines
Hehe, ugly. How about making it a single string? GCC preprocessor documentation suggests the same anyway ...
Neither
#error' nor#warning' macro-expands its argument. Internal whitespace sequences are each replaced with a single space. The line must consist of complete tokens. It is wisest to make the argument of these directives be a single string constant; this avoids problems with apostrophes and the like.
What this is telling you is to put the text into a string constant, which means you add quotation marks at the beginning and end of the line, like
#warning "see http://example.com/"
Quoted 5 lines
From
45f24db45faa06aad01cfc62ff4b475380e5cb11Mon Sep 17 00:00:00 2001
From: Justin P. Mattock <[email protected]>
Date: Wed, 30 Jun 2010 14:06:18 -0700
Subject: [PATCH]kernel.h Fix #warning message according to the GCC preprocessor docs.
BTW, your mail client adds incorrect word wrapping.
Quoted 11 lines
include/linux/kernel.h +0
-1@@ -730,7 +730,7 @@ extern int do_sysinfo(struct sysinfo *info);#ifndef __EXPORTED_HEADERS__#ifndef __KERNEL__ -#warning Attempt to use kernel headers from user space, seehttp://kernelnewbies.org/KernelHeaders
+#warning Attempt to use kernel headers from user space!
#endif /*__KERNEL__*/
#endif /*__EXPORTED_HEADERS__*/
Here, too.
Also, since you're already touching the warning message, it would be nice to move it from kernel.h to types.h, which is much more commonly used. When I introduced the message, I made the mistake to think that kernel.h was universally used by the majority of all headers, which turned out to be wrong. linux/types.h (or possibly linux/stddef.h) seems to be the most commonly used one, so that would be a more adequate place.
Arnd
Quoted 12 lines · Arnd Bergmann
Quoted 10 lines · On Wednesday 30 June 2010 23:20:42 Justin P. Mattock wrote:
Quoted 10 lines
Hehe, ugly. How about making it a single string? GCC preprocessor documentation suggests the same anyway ...
Neither
#error' nor#warning' macro-expands its argument. Internal whitespace sequences are each replaced with a single space. The line must consist of complete tokens. It is wisest to make the argument of these directives be a single string constant; this avoids problems with apostrophes and the like.
Quoted 5 lines
What this is telling you is to put the text into a string constant, which means you add quotation marks at the beginning and end of the line, like
#warning "see http://example.com/"
just realized that whole comment. was thrown off by the ` ' things.
Quoted 8 lines
Quoted 5 lines
From 45f24db45faa06aad01cfc62ff4b475380e5cb11 Mon Sep 17 00:00:00 2001From: Justin P. Mattock<[email protected]>
Date: Wed, 30 Jun 2010 14:06:18 -0700
Subject: [PATCH]kernel.h Fix #warning message according to the GCC preprocessor docs.BTW, your mail client adds incorrect word wrapping.
I'm copy/pasting from another machine(vnc) somehow thunderbird is churning this up when doing so.
Quoted 22 lines
Quoted 11 lines
include/linux/kernel.h +0
-1@@ -730,7 +730,7 @@ extern int do_sysinfo(struct sysinfo *info);#ifndef __EXPORTED_HEADERS__#ifndef __KERNEL__ -#warning Attempt to use kernel headers from user space, seehttp://kernelnewbies.org/KernelHeaders
+#warning Attempt to use kernel headers from user space!#endif /* __KERNEL__ */ #endif /* __EXPORTED_HEADERS__ */Here, too.
Also, since you're already touching the warning message, it would be nice to move it from
kernel.htotypes.h, which is much more commonly used. When I introduced the message, I made the mistake to think thatkernel.hwas universally used by the majority of all headers, which turned out to be wrong.linux/types.h(or possiblylinux/stddef.h) seems to be the most commonly used one, so that would be a more adequate place.
Quoted 2 lines
Arnd
o.k. just sent a patch, but please have a look, Im not sure if it's correct.(if theres a test case I can use let me know, seems my printk program is not working with this change).
Justin P. Mattock