mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 01:55:52 +01:00
Add list_config generation
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
parent
18a59b7d4c
commit
0abd677ed7
@ -39,4 +39,12 @@
|
|||||||
*/
|
*/
|
||||||
int query_config( const char *config );
|
int query_config( const char *config );
|
||||||
|
|
||||||
|
/** List all enabled configuration symbols
|
||||||
|
*
|
||||||
|
* \note This function is defined in `programs/test/query_config.c`
|
||||||
|
* which is automatically generated by
|
||||||
|
* `scripts/generate_query_config.pl`.
|
||||||
|
*/
|
||||||
|
void list_config( void );
|
||||||
|
|
||||||
#endif /* MBEDTLS_PROGRAMS_TEST_QUERY_CONFIG_H */
|
#endif /* MBEDTLS_PROGRAMS_TEST_QUERY_CONFIG_H */
|
||||||
|
@ -115,6 +115,10 @@
|
|||||||
#define MACRO_NAME_TO_STR(macro) \
|
#define MACRO_NAME_TO_STR(macro) \
|
||||||
mbedtls_printf( "%s", strlen( #macro "" ) > 0 ? #macro "\n" : "" )
|
mbedtls_printf( "%s", strlen( #macro "" ) > 0 ? #macro "\n" : "" )
|
||||||
|
|
||||||
|
#define NAME_TO_STR(macro) #macro
|
||||||
|
#define OUTPUT_MACRO_NAME_VALUE(macro) mbedtls_printf( #macro "%s\n", \
|
||||||
|
strlen( NAME_TO_STR(macro) "") > 0 ? "=" NAME_TO_STR(macro) : "" )
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
/*
|
/*
|
||||||
* Visual Studio throws the warning 4003 because many Mbed TLS feature macros
|
* Visual Studio throws the warning 4003 because many Mbed TLS feature macros
|
||||||
@ -134,6 +138,10 @@ CHECK_CONFIG /* If the symbol is not found, return an error */
|
|||||||
return( 1 );
|
return( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void list_config( void )
|
||||||
|
{
|
||||||
|
LIST_CONFIG
|
||||||
|
}
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif /* _MSC_VER */
|
#endif /* _MSC_VER */
|
||||||
|
@ -53,6 +53,7 @@ open(CONFIG_FILE, "$config_file") or die "Opening config file '$config_file': $!
|
|||||||
# This variable will contain the string to replace in the CHECK_CONFIG of the
|
# This variable will contain the string to replace in the CHECK_CONFIG of the
|
||||||
# format file
|
# format file
|
||||||
my $config_check = "";
|
my $config_check = "";
|
||||||
|
my $list_config = "";
|
||||||
|
|
||||||
while (my $line = <CONFIG_FILE>) {
|
while (my $line = <CONFIG_FILE>) {
|
||||||
if ($line =~ /^(\/\/)?\s*#\s*define\s+(MBEDTLS_\w+).*/) {
|
if ($line =~ /^(\/\/)?\s*#\s*define\s+(MBEDTLS_\w+).*/) {
|
||||||
@ -72,6 +73,11 @@ while (my $line = <CONFIG_FILE>) {
|
|||||||
$config_check .= " }\n";
|
$config_check .= " }\n";
|
||||||
$config_check .= "#endif /* $name */\n";
|
$config_check .= "#endif /* $name */\n";
|
||||||
$config_check .= "\n";
|
$config_check .= "\n";
|
||||||
|
|
||||||
|
$list_config .= "#if defined($name)\n";
|
||||||
|
$list_config .= " OUTPUT_MACRO_NAME_VALUE($name);\n";
|
||||||
|
$list_config .= "#endif /* $name */\n";
|
||||||
|
$list_config .= "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,6 +89,7 @@ close(FORMAT_FILE);
|
|||||||
|
|
||||||
# Replace the body of the query_config() function with the code we just wrote
|
# Replace the body of the query_config() function with the code we just wrote
|
||||||
$query_config_format =~ s/CHECK_CONFIG/$config_check/g;
|
$query_config_format =~ s/CHECK_CONFIG/$config_check/g;
|
||||||
|
$query_config_format =~ s/LIST_CONFIG/$list_config/g;
|
||||||
|
|
||||||
# Rewrite the query_config.c file
|
# Rewrite the query_config.c file
|
||||||
open(QUERY_CONFIG_FILE, ">$query_config_file") or die "Opening destination file '$query_config_file': $!";
|
open(QUERY_CONFIG_FILE, ">$query_config_file") or die "Opening destination file '$query_config_file': $!";
|
||||||
|
Loading…
Reference in New Issue
Block a user