mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-04 04:32:24 -05:00 
			
		
		
		
	Exclude macros from query_config.c generation
This commit is contained in:
		
							parent
							
								
									27b3372c45
								
							
						
					
					
						commit
						ef672f0319
					
				@ -2413,14 +2413,6 @@ int query_config( const char *config )
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
#endif /* MBEDTLS_SSL_COOKIE_TIMEOUT */
 | 
					#endif /* MBEDTLS_SSL_COOKIE_TIMEOUT */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(MBEDTLS_SSL_CIPHERSUITES)
 | 
					 | 
				
			||||||
    if( strcmp( "MBEDTLS_SSL_CIPHERSUITES", config ) == 0 )
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_CIPHERSUITES );
 | 
					 | 
				
			||||||
        return( 0 );
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
#endif /* MBEDTLS_SSL_CIPHERSUITES */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if defined(MBEDTLS_X509_MAX_INTERMEDIATE_CA)
 | 
					#if defined(MBEDTLS_X509_MAX_INTERMEDIATE_CA)
 | 
				
			||||||
    if( strcmp( "MBEDTLS_X509_MAX_INTERMEDIATE_CA", config ) == 0 )
 | 
					    if( strcmp( "MBEDTLS_X509_MAX_INTERMEDIATE_CA", config ) == 0 )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
				
			|||||||
@ -23,6 +23,15 @@ my $config_file = "./include/mbedtls/config.h";
 | 
				
			|||||||
my $query_config_format_file = "./scripts/data_files/query_config.fmt";
 | 
					my $query_config_format_file = "./scripts/data_files/query_config.fmt";
 | 
				
			||||||
my $query_config_file = "./programs/ssl/query_config.c";
 | 
					my $query_config_file = "./programs/ssl/query_config.c";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Excluded macros from the generated query_config.c. For example, macros that
 | 
				
			||||||
 | 
					# have commas or function-like macros cannot be transformed into strings easily
 | 
				
			||||||
 | 
					# using the preprocessor, so they should be excluded or the preprocessor will
 | 
				
			||||||
 | 
					# throw errors.
 | 
				
			||||||
 | 
					my @excluded = qw(
 | 
				
			||||||
 | 
					MBEDTLS_SSL_CIPHERSUITES
 | 
				
			||||||
 | 
					);
 | 
				
			||||||
 | 
					my $excluded_re = join '|', @excluded;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
open(CONFIG_FILE, "$config_file") or die "Opening config file '$config_file': $!";
 | 
					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
 | 
				
			||||||
@ -36,6 +45,9 @@ while (my $line = <CONFIG_FILE>) {
 | 
				
			|||||||
        # Skip over the macro that prevents multiple inclusion
 | 
					        # Skip over the macro that prevents multiple inclusion
 | 
				
			||||||
        next if "MBEDTLS_CONFIG_H" eq $name;
 | 
					        next if "MBEDTLS_CONFIG_H" eq $name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Skip over the macro if it is in the ecluded list
 | 
				
			||||||
 | 
					        next if $name =~ /$excluded_re/;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $config_check .= "#if defined($name)\n";
 | 
					        $config_check .= "#if defined($name)\n";
 | 
				
			||||||
        $config_check .= "    if( strcmp( \"$name\", config ) == 0 )\n";
 | 
					        $config_check .= "    if( strcmp( \"$name\", config ) == 0 )\n";
 | 
				
			||||||
        $config_check .= "    {\n";
 | 
					        $config_check .= "    {\n";
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user