OK for trunk?
-- >8 --
This change fixes the following two errors:
Traceback (most recent call last):
File "../contrib/header-tools/gcc-order-headers", line 267, in <module>
process_known_dups ()
File "../contrib/header-tools/gcc-order-headers", line 101, in
process_known_dups
if dups[i] and "rtl.h" in dups[i]:
~~~~^^^
KeyError: 'insn-modes.h'
Traceback (most recent call last):
File "../contrib/header-tools/gcc-order-headers", line 267, in <module>
process_known_dups ()
File "../contrib/header-tools/gcc-order-headers", line 103, in
process_known_dups
if not dups[i]:
~~~~^^^
KeyError: 'insn-modes.h'
Use 'if i in dups' to check whether the key is present in the dict.
contrib/header-tools/ChangeLog:
* gcc-order-headers (process_known_dups): Check if key is in
dict before accessing it.
---
contrib/header-tools/gcc-order-headers | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/contrib/header-tools/gcc-order-headers
b/contrib/header-tools/gcc-order-headers
index 87fdddf60ee..85144cbd67b 100755
--- a/contrib/header-tools/gcc-order-headers
+++ b/contrib/header-tools/gcc-order-headers
@@ -98,10 +98,11 @@ def process_known_dups ():
rtl_remove = includes["coretypes.h"][1] + ["statistics.h", "vec.h"]
if dups:
for i in rtl_remove:
- if dups[i] and "rtl.h" in dups[i]:
- dups[i].remove("rtl.h")
- if not dups[i]:
- dups.pop (i, None)
+ if i in dups:
+ if "rtl.h" in dups[i]:
+ dups[i].remove("rtl.h")
+ if not dups[i]:
+ dups.pop (i, None)
# make sure diagnostic.h is the owner of diagnostic-core.h
if includes["diagnostic-core.h"][0] != "diagnostic.h":
--
2.45.1