diff --git a/.gitattributes b/.gitattributes index b56c468b60c519126c53eeb8773852ea2f107044..31a62b58ca5e15de7258e7b12b588a7d4f14502e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 ####################### diff --git a/share/machdeps/machdep_avr_16.json b/share/machdeps/machdep_avr_16.json index 785839a0b5add87321632c1beadf9e467d6812ba..73c347759aa849819c498d27587116f8e95962a2 100644 --- a/share/machdeps/machdep_avr_16.json +++ b/share/machdeps/machdep_avr_16.json @@ -33,4 +33,4 @@ "sizeof_void": 1, "version": "clang version 15.0.7", "wchar_t": "int" -} \ No newline at end of file +} diff --git a/share/machdeps/machdep_gcc_x86_32.json b/share/machdeps/machdep_gcc_x86_32.json index f7030722574f21f0cdc1f6eca07b500af6ebc6f6..242baf3bcf908f546c998e8d5cc5179b5edfd7b3 100644 --- a/share/machdeps/machdep_gcc_x86_32.json +++ b/share/machdeps/machdep_gcc_x86_32.json @@ -31,4 +31,4 @@ "sizeof_void": 1, "version": "gcc (GCC) 12.2.1 20230201", "wchar_t": "long" -} \ No newline at end of file +} diff --git a/share/machdeps/machdep_gcc_x86_64.json b/share/machdeps/machdep_gcc_x86_64.json index 28932cf951bc1b450440051556acb49b49aa1c66..426898d9c08f1d05403bc9d50a36422fc2301e29 100644 --- a/share/machdeps/machdep_gcc_x86_64.json +++ b/share/machdeps/machdep_gcc_x86_64.json @@ -31,4 +31,4 @@ "sizeof_void": 1, "version": "gcc (GCC) 12.2.1 20230201", "wchar_t": "int" -} \ No newline at end of file +} diff --git a/share/machdeps/machdep_ppc_32.json b/share/machdeps/machdep_ppc_32.json index 610cbb38fab066d2dfdf11c4763f9c3593390800..aec4b71b5ba1960b31427bc2c34e979f8adc8d16 100644 --- a/share/machdeps/machdep_ppc_32.json +++ b/share/machdeps/machdep_ppc_32.json @@ -33,4 +33,4 @@ "sizeof_void": 1, "version": "clang version 15.0.7", "wchar_t": "int" -} \ No newline at end of file +} diff --git a/share/machdeps/make_machdep/make_machdep.py b/share/machdeps/make_machdep/make_machdep.py index a5fbaa1eaea6968ae5676a05cb8240eda4173fb4..a4295c73770aa3338c201382bfa591a4217eea15 100755 --- a/share/machdeps/make_machdep/make_machdep.py +++ b/share/machdeps/make_machdep/make_machdep.py @@ -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: