Skip to content
Snippets Groups Projects
Commit cf960dbb authored by Virgile Prevosto's avatar Virgile Prevosto Committed by Andre Maroneze
Browse files

[machdep] generator ends the file with a proper \n + pass lint and headers

parent 48af2ed3
No related branches found
No related tags found
No related merge requests found
......@@ -267,7 +267,7 @@ README* header_spec=.ignore
/share/win32_manual_installation_step.txt header_spec=.ignore
/share/compliance/*.json header_spec=.ignore
/share/machdeps/machdep-schema.json header_spec=.ignore
/share/machdeps/machdep_*.json header_spec=.ignore
/tests/**/* header_spec=.ignore
#######################
......
......@@ -33,4 +33,4 @@
"sizeof_void": 1,
"version": "clang version 15.0.7",
"wchar_t": "int"
}
\ No newline at end of file
}
......@@ -31,4 +31,4 @@
"sizeof_void": 1,
"version": "gcc (GCC) 12.2.1 20230201",
"wchar_t": "long"
}
\ No newline at end of file
}
......@@ -31,4 +31,4 @@
"sizeof_void": 1,
"version": "gcc (GCC) 12.2.1 20230201",
"wchar_t": "int"
}
\ No newline at end of file
}
......@@ -33,4 +33,4 @@
"sizeof_void": 1,
"version": "clang version 15.0.7",
"wchar_t": "int"
}
\ No newline at end of file
}
......@@ -72,12 +72,13 @@ parser.add_argument(
parser.add_argument(
"--from-file",
help="reads compiler and arch flags from existing json file. Use -i to update it in place"
help="reads compiler and arch flags from existing json file. Use -i to update it in place",
)
parser.add_argument(
"-i", "--in-place",
"-i",
"--in-place",
action="store_true",
help="when reading compiler config from json, update the file in place. unused otherwise"
help="when reading compiler config from json, update the file in place. unused otherwise",
)
parser.add_argument(
......@@ -102,21 +103,25 @@ if not args.compiler_flags:
if args.from_file:
orig_file = open(args.from_file,"r")
orig_file = open(args.from_file, "r")
orig_machdep = json.load(orig_file)
orig_file.close()
if not "compiler" in orig_machdep or not "cpp_arch_flags" in orig_machdep:
raise Exception("Missing fields in json file")
args.compiler = orig_machdep["compiler"]
if isinstance(orig_machdep["cpp_arch_flags"],list):
if isinstance(orig_machdep["cpp_arch_flags"], list):
args.cpp_arch_flags = orig_machdep["cpp_arch_flags"]
else: # old version of the schema used a single string
else: # old version of the schema used a single string
args.cpp_arch_flags = orig_machdep["cpp_arch_flags"].split()
def print_machdep(machdep):
if args.in_place:
args.dest_file = open(args.from_file,"w")
args.dest_file = open(args.from_file, "w")
json.dump(machdep, args.dest_file, indent=4, sort_keys=True)
# Python does not end the dump with a newline by itself
args.dest_file.write("\n")
def check_machdep(machdep):
try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment