mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
The list of function/macro properties is not MISRA-specific documentation.
Their addition was directly motivated to address MISRA findings and they
are not used elsewhere. For this reason, this patch moves these properties
in docs/misra.
This patch also fixes a Sphinx warning caused by the missing inclusion
of the rst file in the toctree.
Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Fixes: f4519ee8 ("eclair: move function and macro properties outside ECLAIR")
Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
38 lines
962 B
Python
38 lines
962 B
Python
import json
|
|
import os
|
|
|
|
script_dir = os.path.dirname(__file__)
|
|
properties_path = os.path.join(script_dir, "../../docs/misra/function-macro-properties.json")
|
|
output_path = os.path.join(script_dir, "ECLAIR/call_properties.ecl")
|
|
|
|
with open(properties_path) as fp:
|
|
properties = json.load(fp)['content']
|
|
|
|
ecl = open(output_path, 'w')
|
|
|
|
for record in properties:
|
|
|
|
string = "-call_properties+={\""
|
|
if record['type'] == "function":
|
|
string += f"{record['value']}\", {{".replace("\\", "\\\\")
|
|
else:
|
|
string += f"{record['type']}({record['value']})\", {{".replace("\\", "\\\\")
|
|
|
|
i=0
|
|
for prop in record['properties'].items():
|
|
if prop[0] == 'attribute':
|
|
string += prop[1]
|
|
i+=1
|
|
else:
|
|
string += f"\"{prop[0]}({prop[1]})\""
|
|
i+=1
|
|
|
|
if i<len(record['properties']):
|
|
string += ", "
|
|
else:
|
|
string +="}}\n"
|
|
|
|
ecl.write(string)
|
|
|
|
ecl.close()
|