From bfe5b139052bc7d6a9dda520b39e3caef53687f5 Mon Sep 17 00:00:00 2001 From: Roland Dobai Date: Mon, 6 May 2019 15:06:19 +0200 Subject: [PATCH] tools/gen_esp_err_to_name.py: Don't include already included headers --- components/esp_common/src/esp_err_to_name.c | 3 --- tools/gen_esp_err_to_name.py | 7 ++++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/components/esp_common/src/esp_err_to_name.c b/components/esp_common/src/esp_err_to_name.c index 5c3698576..d0b17543c 100644 --- a/components/esp_common/src/esp_err_to_name.c +++ b/components/esp_common/src/esp_err_to_name.c @@ -11,9 +11,6 @@ #if __has_include("esp_efuse.h") #include "esp_efuse.h" #endif -#if __has_include("esp_err.h") -#include "esp_err.h" -#endif #if __has_include("esp_http_client.h") #include "esp_http_client.h" #endif diff --git a/tools/gen_esp_err_to_name.py b/tools/gen_esp_err_to_name.py index bd9d4b045..68a7d2112 100755 --- a/tools/gen_esp_err_to_name.py +++ b/tools/gen_esp_err_to_name.py @@ -48,6 +48,10 @@ ignore_dirs = ('examples') # macros from here have higher priorities in case of collisions priority_headers = ['components/esp_common/include/esp_err.h'] +# The following headers won't be included. This is useful if they are permanently included from esp_err_to_name.c.in. +dont_include = ['soc/soc.h', + 'esp_err.h'] + err_dict = collections.defaultdict(list) # identified errors are stored here; mapped by the error code rev_err_dict = dict() # map of error string to error code unproc_list = list() # errors with unknown codes which depend on other errors @@ -265,7 +269,8 @@ def generate_c_output(fin, fout): elif re.match(r'@HEADERS@', line): for i in include_list: - fout.write("#if __has_include(\"" + i + "\")\n#include \"" + i + "\"\n#endif\n") + if i not in dont_include: + fout.write("#if __has_include(\"" + i + "\")\n#include \"" + i + "\"\n#endif\n") elif re.match(r'@ERROR_ITEMS@', line): last_file = "" for k in sorted(err_dict.keys()):