summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Reinhardt <steve.reinhardt@amd.com>2011-09-24 08:12:26 -0700
committerSteve Reinhardt <steve.reinhardt@amd.com>2011-09-24 08:12:26 -0700
commited61e02b24c27b9dad88971ca341b5cd0ae31bd4 (patch)
treed97565097ec428f01a9b7cb5b7a8c89bc58a38ec
parent40b6c9cb2efa3458d8addb90b802ee4d747a4924 (diff)
downloadgem5-ed61e02b24c27b9dad88971ca341b5cd0ae31bd4.tar.xz
style.py: don't die on empty files
-rw-r--r--util/style.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/util/style.py b/util/style.py
index 2b9f654d4..498bdf530 100644
--- a/util/style.py
+++ b/util/style.py
@@ -233,6 +233,9 @@ class SortedIncludes(Verifier):
old = ''.join(line + '\n' for line in lines)
f.close()
+ if len(lines) == 0:
+ return 0
+
language = lang_type(filename, lines[0])
sort_lines = list(self.sort_includes(lines, filename, language))
new = ''.join(line + '\n' for line in sort_lines)