Remove generation of ssl_debug_helpers_generated.h
It's now under version control and meant to be updated manually. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
09f1ee68b6
commit
ccbc318fc5
4 changed files with 7 additions and 45 deletions
|
@ -147,7 +147,6 @@ if(GEN_FILES)
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT
|
OUTPUT
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/ssl_debug_helpers_generated.h
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/ssl_debug_helpers_generated.c
|
${CMAKE_CURRENT_BINARY_DIR}/ssl_debug_helpers_generated.c
|
||||||
COMMAND
|
COMMAND
|
||||||
${MBEDTLS_PYTHON_EXECUTABLE}
|
${MBEDTLS_PYTHON_EXECUTABLE}
|
||||||
|
@ -162,7 +161,6 @@ else()
|
||||||
link_to_source(error.c)
|
link_to_source(error.c)
|
||||||
link_to_source(version_features.c)
|
link_to_source(version_features.c)
|
||||||
link_to_source(ssl_debug_helpers_generated.c)
|
link_to_source(ssl_debug_helpers_generated.c)
|
||||||
link_to_source(ssl_debug_helpers_generated.h)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCC)
|
if(CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
|
|
@ -290,7 +290,7 @@ libmbedcrypto.dll: $(OBJS_CRYPTO)
|
||||||
.PHONY: generated_files
|
.PHONY: generated_files
|
||||||
GENERATED_FILES = \
|
GENERATED_FILES = \
|
||||||
error.c version_features.c \
|
error.c version_features.c \
|
||||||
ssl_debug_helpers_generated.c ssl_debug_helpers_generated.h
|
ssl_debug_helpers_generated.c
|
||||||
generated_files: $(GENERATED_FILES)
|
generated_files: $(GENERATED_FILES)
|
||||||
|
|
||||||
error.c: ../scripts/generate_errors.pl
|
error.c: ../scripts/generate_errors.pl
|
||||||
|
@ -300,10 +300,9 @@ error.c:
|
||||||
echo " Gen $@"
|
echo " Gen $@"
|
||||||
$(PERL) ../scripts/generate_errors.pl
|
$(PERL) ../scripts/generate_errors.pl
|
||||||
|
|
||||||
ssl_debug_helpers_generated.c: | ssl_debug_helpers_generated.h
|
ssl_debug_helpers_generated.c: ../scripts/generate_ssl_debug_helpers.py
|
||||||
ssl_debug_helpers_generated.h: ../scripts/generate_ssl_debug_helpers.py
|
ssl_debug_helpers_generated.c: $(filter-out %config%,$(wildcard ../include/mbedtls/*.h))
|
||||||
ssl_debug_helpers_generated.h: $(filter-out %config%,$(wildcard ../include/mbedtls/*.h))
|
ssl_debug_helpers_generated.c:
|
||||||
ssl_debug_helpers_generated.h:
|
|
||||||
echo " Gen $@"
|
echo " Gen $@"
|
||||||
$(PYTHON) ../scripts/generate_ssl_debug_helpers.py --mbedtls-root .. .
|
$(PYTHON) ../scripts/generate_ssl_debug_helpers.py --mbedtls-root .. .
|
||||||
|
|
||||||
|
|
|
@ -232,10 +232,7 @@ class EnumDefinition:
|
||||||
body = body.format(translation_table='\n'.join(translation_table),
|
body = body.format(translation_table='\n'.join(translation_table),
|
||||||
name=self._name,
|
name=self._name,
|
||||||
prototype=self._prototype)
|
prototype=self._prototype)
|
||||||
prototype = 'const char *{name}_str( {prototype} in );\n'
|
return body
|
||||||
prototype = prototype.format(name=self._name,
|
|
||||||
prototype=self._prototype)
|
|
||||||
return body, prototype
|
|
||||||
|
|
||||||
|
|
||||||
OUTPUT_C_TEMPLATE = '''\
|
OUTPUT_C_TEMPLATE = '''\
|
||||||
|
@ -254,28 +251,6 @@ OUTPUT_C_TEMPLATE = '''\
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
OUTPUT_H_TEMPLATE = '''\
|
|
||||||
/* Automatically generated by generate_ssl_debug_helpers.py. DO NOT EDIT. */
|
|
||||||
#ifndef MBEDTLS_SSL_DEBUG_HELPERS_H
|
|
||||||
#define MBEDTLS_SSL_DEBUG_HELPERS_H
|
|
||||||
|
|
||||||
#include "common.h"
|
|
||||||
|
|
||||||
#if defined(MBEDTLS_DEBUG_C)
|
|
||||||
|
|
||||||
#include "mbedtls/ssl.h"
|
|
||||||
#include "ssl_misc.h"
|
|
||||||
|
|
||||||
{functions}
|
|
||||||
|
|
||||||
#endif /* MBEDTLS_DEBUG_C */
|
|
||||||
|
|
||||||
#endif /* SSL_DEBUG_HELPERS_H */
|
|
||||||
|
|
||||||
/* End of automatically generated file. */
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
|
|
||||||
def generate_ssl_debug_helpers(output_directory, mbedtls_root):
|
def generate_ssl_debug_helpers(output_directory, mbedtls_root):
|
||||||
"""
|
"""
|
||||||
|
@ -286,23 +261,17 @@ def generate_ssl_debug_helpers(output_directory, mbedtls_root):
|
||||||
source_code = remove_c_comments(f.read())
|
source_code = remove_c_comments(f.read())
|
||||||
|
|
||||||
definitions = dict()
|
definitions = dict()
|
||||||
prototypes = dict()
|
|
||||||
for start, instance in preprocess_c_source_code(source_code, EnumDefinition):
|
for start, instance in preprocess_c_source_code(source_code, EnumDefinition):
|
||||||
if start in definitions:
|
if start in definitions:
|
||||||
continue
|
continue
|
||||||
if isinstance(instance, EnumDefinition):
|
if isinstance(instance, EnumDefinition):
|
||||||
definition, prototype = instance.generate_tranlation_function()
|
definition = instance.generate_tranlation_function()
|
||||||
else:
|
else:
|
||||||
definition = instance
|
definition = instance
|
||||||
prototype = instance
|
|
||||||
definitions[start] = definition
|
definitions[start] = definition
|
||||||
prototypes[start] = prototype
|
|
||||||
|
|
||||||
function_definitions = [str(v) for _, v in sorted(definitions.items())]
|
function_definitions = [str(v) for _, v in sorted(definitions.items())]
|
||||||
function_prototypes = [str(v) for _, v in sorted(prototypes.items())]
|
|
||||||
if output_directory == sys.stdout:
|
if output_directory == sys.stdout:
|
||||||
sys.stdout.write(OUTPUT_H_TEMPLATE.format(
|
|
||||||
functions='\n'.join(function_prototypes)))
|
|
||||||
sys.stdout.write(OUTPUT_C_TEMPLATE.format(
|
sys.stdout.write(OUTPUT_C_TEMPLATE.format(
|
||||||
functions='\n'.join(function_definitions)))
|
functions='\n'.join(function_definitions)))
|
||||||
else:
|
else:
|
||||||
|
@ -310,10 +279,6 @@ def generate_ssl_debug_helpers(output_directory, mbedtls_root):
|
||||||
f.write(OUTPUT_C_TEMPLATE.format(
|
f.write(OUTPUT_C_TEMPLATE.format(
|
||||||
functions='\n'.join(function_definitions)))
|
functions='\n'.join(function_definitions)))
|
||||||
|
|
||||||
with open(os.path.join(output_directory, 'ssl_debug_helpers_generated.h'), 'w') as f:
|
|
||||||
f.write(OUTPUT_H_TEMPLATE.format(
|
|
||||||
functions='\n'.join(function_prototypes)))
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -118,7 +118,7 @@ check()
|
||||||
check scripts/generate_errors.pl library/error.c
|
check scripts/generate_errors.pl library/error.c
|
||||||
check scripts/generate_query_config.pl programs/test/query_config.c
|
check scripts/generate_query_config.pl programs/test/query_config.c
|
||||||
check scripts/generate_features.pl library/version_features.c
|
check scripts/generate_features.pl library/version_features.c
|
||||||
check scripts/generate_ssl_debug_helpers.py library/ssl_debug_helpers_generated.h library/ssl_debug_helpers_generated.c
|
check scripts/generate_ssl_debug_helpers.py library/ssl_debug_helpers_generated.c
|
||||||
# generate_visualc_files enumerates source files (library/*.c). It doesn't
|
# generate_visualc_files enumerates source files (library/*.c). It doesn't
|
||||||
# care about their content, but the files must exist. So it must run after
|
# care about their content, but the files must exist. So it must run after
|
||||||
# the step that creates or updates these files.
|
# the step that creates or updates these files.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue