Skip to content

Commit

Permalink
tools/gen_esp_err_to_name.py: Don't include already included headers
Browse files Browse the repository at this point in the history
  • Loading branch information
dobairoland authored and trombik committed Aug 9, 2019
1 parent a9d4c4a commit d636aab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 0 additions & 3 deletions components/esp_common/src/esp_err_to_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion tools/gen_esp_err_to_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
# 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
Expand Down Expand Up @@ -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()):
Expand Down

0 comments on commit d636aab

Please sign in to comment.