* [PATCH bpf-next] scripts/bpf: Emit an #error directive known types list needs updating
@ 2019-10-16 8:58 Jakub Sitnicki
2019-10-16 12:31 ` Daniel Borkmann
2019-10-16 20:29 ` Andrii Nakryiko
0 siblings, 2 replies; 4+ messages in thread
From: Jakub Sitnicki @ 2019-10-16 8:58 UTC (permalink / raw)
To: bpf; +Cc: netdev, kernel-team
Make the compiler report a clear error when bpf_helpers_doc.py needs
updating rather than rely on the fact that Clang fails to compile
English:
../../../lib/bpf/bpf_helper_defs.h:2707:1: error: unknown type name 'Unrecognized'
Unrecognized type 'struct bpf_inet_lookup', please add it to known types!
Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
---
scripts/bpf_helpers_doc.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/bpf_helpers_doc.py b/scripts/bpf_helpers_doc.py
index 7df9ce598ff9..08300bc024da 100755
--- a/scripts/bpf_helpers_doc.py
+++ b/scripts/bpf_helpers_doc.py
@@ -489,7 +489,7 @@ class PrinterHelpers(Printer):
if t in self.mapped_types:
return self.mapped_types[t]
print("")
- print("Unrecognized type '%s', please add it to known types!" % t)
+ print("#error \"Unrecognized type '%s', please add it to known types!\"" % t)
sys.exit(1)
seen_helpers = set()
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next] scripts/bpf: Emit an #error directive known types list needs updating
2019-10-16 8:58 [PATCH bpf-next] scripts/bpf: Emit an #error directive known types list needs updating Jakub Sitnicki
@ 2019-10-16 12:31 ` Daniel Borkmann
2019-10-16 20:29 ` Andrii Nakryiko
1 sibling, 0 replies; 4+ messages in thread
From: Daniel Borkmann @ 2019-10-16 12:31 UTC (permalink / raw)
To: Jakub Sitnicki; +Cc: bpf, netdev, kernel-team
On Wed, Oct 16, 2019 at 10:58:11AM +0200, Jakub Sitnicki wrote:
> Make the compiler report a clear error when bpf_helpers_doc.py needs
> updating rather than rely on the fact that Clang fails to compile
> English:
>
> ../../../lib/bpf/bpf_helper_defs.h:2707:1: error: unknown type name 'Unrecognized'
> Unrecognized type 'struct bpf_inet_lookup', please add it to known types!
>
> Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
Applied, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next] scripts/bpf: Emit an #error directive known types list needs updating
2019-10-16 8:58 [PATCH bpf-next] scripts/bpf: Emit an #error directive known types list needs updating Jakub Sitnicki
2019-10-16 12:31 ` Daniel Borkmann
@ 2019-10-16 20:29 ` Andrii Nakryiko
2019-10-17 9:50 ` Jakub Sitnicki
1 sibling, 1 reply; 4+ messages in thread
From: Andrii Nakryiko @ 2019-10-16 20:29 UTC (permalink / raw)
To: Jakub Sitnicki; +Cc: bpf, Networking, kernel-team
On Wed, Oct 16, 2019 at 6:21 AM Jakub Sitnicki <jakub@cloudflare.com> wrote:
>
> Make the compiler report a clear error when bpf_helpers_doc.py needs
> updating rather than rely on the fact that Clang fails to compile
> English:
>
> ../../../lib/bpf/bpf_helper_defs.h:2707:1: error: unknown type name 'Unrecognized'
> Unrecognized type 'struct bpf_inet_lookup', please add it to known types!
>
> Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
> ---
> scripts/bpf_helpers_doc.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/bpf_helpers_doc.py b/scripts/bpf_helpers_doc.py
> index 7df9ce598ff9..08300bc024da 100755
> --- a/scripts/bpf_helpers_doc.py
> +++ b/scripts/bpf_helpers_doc.py
> @@ -489,7 +489,7 @@ class PrinterHelpers(Printer):
> if t in self.mapped_types:
> return self.mapped_types[t]
> print("")
> - print("Unrecognized type '%s', please add it to known types!" % t)
> + print("#error \"Unrecognized type '%s', please add it to known types!\"" % t)
My bad, this was intended to be printed to stderr, not to stdout
output. Can you please do a follow up patch turning this into eprint
instead?
This shouldn't be reported by Clang, rather by tool. And we should
ensure in libbpf's Makefile that bpf_helper_defs.h is deleted on
error. I'll do it a bit later, unless you'll beat me to it.
> sys.exit(1)
>
> seen_helpers = set()
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next] scripts/bpf: Emit an #error directive known types list needs updating
2019-10-16 20:29 ` Andrii Nakryiko
@ 2019-10-17 9:50 ` Jakub Sitnicki
0 siblings, 0 replies; 4+ messages in thread
From: Jakub Sitnicki @ 2019-10-17 9:50 UTC (permalink / raw)
To: Andrii Nakryiko; +Cc: bpf, Networking, kernel-team
On Wed, Oct 16, 2019 at 10:29 PM CEST, Andrii Nakryiko wrote:
> On Wed, Oct 16, 2019 at 6:21 AM Jakub Sitnicki <jakub@cloudflare.com> wrote:
>>
>> Make the compiler report a clear error when bpf_helpers_doc.py needs
>> updating rather than rely on the fact that Clang fails to compile
>> English:
>>
>> ../../../lib/bpf/bpf_helper_defs.h:2707:1: error: unknown type name 'Unrecognized'
>> Unrecognized type 'struct bpf_inet_lookup', please add it to known types!
>>
>> Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
>> ---
>> scripts/bpf_helpers_doc.py | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/scripts/bpf_helpers_doc.py b/scripts/bpf_helpers_doc.py
>> index 7df9ce598ff9..08300bc024da 100755
>> --- a/scripts/bpf_helpers_doc.py
>> +++ b/scripts/bpf_helpers_doc.py
>> @@ -489,7 +489,7 @@ class PrinterHelpers(Printer):
>> if t in self.mapped_types:
>> return self.mapped_types[t]
>> print("")
>> - print("Unrecognized type '%s', please add it to known types!" % t)
>> + print("#error \"Unrecognized type '%s', please add it to known types!\"" % t)
>
> My bad, this was intended to be printed to stderr, not to stdout
> output. Can you please do a follow up patch turning this into eprint
> instead?
>
> This shouldn't be reported by Clang, rather by tool. And we should
> ensure in libbpf's Makefile that bpf_helper_defs.h is deleted on
> error. I'll do it a bit later, unless you'll beat me to it.
This sounds sensible. I could have guessed it. Here's the fix:
https://lore.kernel.org/bpf/20191017094416.7688-1-jakub@cloudflare.com/T/#u
-Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-17 9:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-16 8:58 [PATCH bpf-next] scripts/bpf: Emit an #error directive known types list needs updating Jakub Sitnicki
2019-10-16 12:31 ` Daniel Borkmann
2019-10-16 20:29 ` Andrii Nakryiko
2019-10-17 9:50 ` Jakub Sitnicki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).