Files
xen/automation/eclair_analysis/propertyparser.py
T
Simone Ballarin b36d850c22 docs: Move function and macro properties in docs/misra
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>
2024-02-29 08:20:05 +01:00

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()