scripts: gen_syscalls: Use explicit encoding when reading headers

In Python, if open() doesn't specify "encoding" parameter,
locale.getpreferredencoding(False) will be used as the default,
as explained in
https://docs.python.org/3/library/functions.html#open ,
which may differ from system to system. So, explicitly specify
"encoding" param in open() call.

Also, fix a typo in a comment.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
This commit is contained in:
Paul Sokolovsky 2017-10-01 23:47:43 +03:00 committed by Andrew Boie
parent 37b9ee0b57
commit 94620bdb0b

View file

@ -94,7 +94,7 @@ def analyze_headers(base_path):
if not fn.endswith(".h") or path.endswith("toolchain/common.h"):
continue
with open(path, "r") as fp:
with open(path, "r", encoding="utf-8") as fp:
try:
result = [analyze_fn(mo.groups(), fn)
for mo in api_regex.finditer(fp.read())]
@ -108,8 +108,8 @@ def analyze_headers(base_path):
table_template = """/* auto-generated by gen_syscalls.py, don't edit */
/* Weak handler functions that get replaced by the real ones unles a system
* call is not implemented due to kernel configuration
/* Weak handler functions that get replaced by the real ones unless a system
* call is not implemented due to kernel configuration.
*/
%s