Skip to content

Commit

Permalink
ENH: add a guard to ensure config.h is never included directly.
Browse files Browse the repository at this point in the history
(cherry picked from commit 1c52adb271bd4b5fecb17a1e4c4e8e7e4667b8ba)
  • Loading branch information
cournape committed Nov 27, 2009
1 parent 65880fd commit abd0408
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions numpy/core/SConscript
Expand Up @@ -316,6 +316,12 @@ if config.CheckCBLAS():
else:
build_blasdot = 0

config.config_h_text += """
#ifndef _NPY_NPY_CONFIG_H_
#error config.h should never be included directly, include npy_config.h instead
#endif
"""

config.Finish()
write_info(env)

Expand Down
8 changes: 8 additions & 0 deletions numpy/core/setup.py
Expand Up @@ -435,6 +435,14 @@ def generate_config_h(ext, build_dir):
target_f.write('#define inline %s\n' % inline)
target_f.write('#endif\n')

# add the guard to make sure config.h is never included directly,
# but always through npy_config.h
target_f.write("""
#ifndef _NPY_NPY_CONFIG_H_
#error config.h should never be included directly, include npy_config.h instead
#endif
""")

target_f.close()
print 'File:',target
target_f = open(target)
Expand Down

0 comments on commit abd0408

Please sign in to comment.