tools: ynl-gen: don't output external constants
authorJakub Kicinski <kuba@kernel.org>
Mon, 3 Feb 2025 21:55:09 +0000 (13:55 -0800)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 6 Feb 2025 10:21:14 +0000 (11:21 +0100)
A definition with a "header" property is an "external" definition
for C code, as in it is defined already in another C header file.
Other languages will need the exact value but C codegen should
not recreate it. So don't output those definitions in the uAPI
header.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Link: https://patch.msgid.link/20250203215510.1288728-1-kuba@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
tools/net/ynl/pyynl/ynl_gen_c.py

index c2eabc90dce8c4ff08335d0a5c82683e738b87bd..aa08b8b1463d0cd573856a8c75cf7afd40756266 100755 (executable)
@@ -2549,6 +2549,9 @@ def render_uapi(family, cw):
 
     defines = []
     for const in family['definitions']:
+        if const.get('header'):
+            continue
+
         if const['type'] != 'const':
             cw.writes_defines(defines)
             defines = []