[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Patches] int/hex/string option types



On 12/05/2011 05:43 PM, Joseph S. Myers wrote:
On Mon, 28 Nov 2011, Steve Longerbeam wrote:

diff -Nupbar -X /home/stevel/dontdiff eglibc.orig/libc/scripts/option-groups.awk eglibc/libc/scripts/option-groups.awk
--- eglibc.orig/libc/scripts/option-groups.awk	2011-11-22 17:32:21.356911312 -0800
+++ eglibc/libc/scripts/option-groups.awk	2011-11-23 15:08:37.792003410 -0800
@@ -46,9 +46,13 @@ END {
                  print "#define __" var " 1"
              else if (vars[var] == "n")
                  print "/* #undef __" var " */"
-            # Ignore variables that don't have boolean values.
-            # Ideally, this would be driven by the types given in
-            # option-groups.def.
+	    else if (vars[var] ~ /^0*x*[0-9]+/ || vars[var] ~ /\"\w*\"/)
I'm not clear on the integer syntax you're expecting to match with
/^0*x*[0-9]+/, but if hex integers are possible (presumably, since you're
allowing 'x') I'd have thought you need to allow for letters a-f after
them.  (Unless this script will only ever run in the C locale, you don't
actually want to use "a-f" directly in a range, since in some locales that
will include other letters as well; spell out all the possible letters
explicitly.)

\"\w*\" also looks wrong for the string syntax; strings such as file names
may well not be restricted to word (alphanumeric and underscore)
characters.


attached is the updated patch to address above issues.

Steve

--
Steve Longerbeam | Senior Embedded Engineer, ESD Services
Mentor Embedded(tm) | 46871 Bayside Parkway, Fremont, CA 94538
P 510.354.5838 | M 408.410.2735
Nucleus(r) | Linux(r) | Android(tm) | Services | UI | Multi-OS

diff -Nupbar -X /home/stevel/dontdiff eglibc.menuconfig/libc/malloc/Makefile eglibc/libc/malloc/Makefile
--- eglibc.menuconfig/libc/malloc/Makefile	2011-12-02 09:53:37.629434560 -0800
+++ eglibc/libc/malloc/Makefile	2011-11-23 11:05:51.463544028 -0800
@@ -48,10 +48,6 @@ non-lib.a := libmcheck.a
 ifeq ($(OPTION_EGLIBC_MEMUSAGE),y)
 extra-libs = libmemusage
 extra-libs-others = $(extra-libs)
-
-ifdef OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
-CPPFLAGS-memusage += -D__OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE=$(OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE)
-endif
 endif
 
 libmemusage-routines = memusage
diff -Nupbar -X /home/stevel/dontdiff eglibc.menuconfig/libc/option-groups.def eglibc/libc/option-groups.def
--- eglibc.menuconfig/libc/option-groups.def	2011-12-02 09:59:01.330638083 -0800
+++ eglibc/libc/option-groups.def	2011-12-07 10:34:16.727387854 -0800
@@ -513,8 +513,11 @@ config EGLIBC_MEMUSAGE
        the `memusage' and `memusagestat' utilities.
        These components provide memory profiling functions.
 
-       EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
-
+config EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
+   int "Memory profiling library buffer size"
+   depends on EGLIBC_MEMUSAGE
+   default "32768"
+   help
        Libmemusage library buffers the profiling data in memory
        before writing it out to disk.  By default, the library
        allocates 1.5M buffer, which can be substantial for some
@@ -553,8 +556,11 @@ config EGLIBC_NSSWITCH
        'option-groups.config' file must set the following two
        variables:
 
-       EGLIBC_NSSWITCH_FIXED_CONFIG
-
+config EGLIBC_NSSWITCH_FIXED_CONFIG
+   string "Nsswitch fixed config filename"
+   depends on !EGLIBC_NSSWITCH
+   default ""
+   help
           Set this to the name of a file whose contents observe the
           same syntax as an ordinary '/etc/nsswitch.conf' file.  The
           EGLIBC build process parses this file just as EGLIBC would
@@ -576,8 +582,11 @@ config EGLIBC_NSSWITCH
           you will probably want to delete references to databases not
           needed on your system.
 
-       EGLIBC_NSSWITCH_FIXED_FUNCTIONS
-
+config EGLIBC_NSSWITCH_FIXED_FUNCTIONS
+   string "Nsswitch fixed functions filename"
+   depends on !EGLIBC_NSSWITCH
+   default ""
+   help
           The EGLIBC build process uses this file to decide which
           functions to make available from which service libraries.
           The file 'nss/fixed-nsswitch.functions' serves as a sample
diff -Nupbar -X /home/stevel/dontdiff eglibc.menuconfig/libc/options-config/config-postproc.pl eglibc/libc/options-config/config-postproc.pl
--- eglibc.menuconfig/libc/options-config/config-postproc.pl	2011-12-07 09:59:50.191628385 -0800
+++ eglibc/libc/options-config/config-postproc.pl	2011-12-07 10:01:44.224036935 -0800
@@ -8,7 +8,7 @@ die "$usage" unless @ARGV;
 die "Could not open $ARGV[0]" unless -T $ARGV[0];
 
 sub yank {
-    @option = grep($_ ne $_[0], @option);
+    @option = grep(!($_ =~ /$_[0]\s*=/), @option);
 }
 
 open(DEFAULTS, $defaults) || die "Could not open $defaults\n";
@@ -16,7 +16,7 @@ open(DEFAULTS, $defaults) || die "Could
 # get the full list of available options using the default config file
 $i = 0;
 while (<DEFAULTS>) {
-    if (/^\s*OPTION_(\w+)\s*=/) {
+    if (/^\s*OPTION_(\w+\s*=.*$)/) {
 	$option[$i++] = $1;
     }
 }
@@ -35,8 +35,9 @@ while (<>) {
 	s/CONFIG_/OPTION_/g;
 	print;
     } elsif (/^\s*#\s+CONFIG_(\w+) is not set/) {
-	# this is a comment line, change CONFIG_ to OPTION_, remove this
-	# option from option list, and convert to explicit OPTION_FOO=n
+	# this is a comment line for an unset boolean option, change CONFIG_
+	# to OPTION_, remove this option from option list, and convert to
+	# explicit OPTION_FOO=n
 	$opt = $1;
 	yank($opt);
 	s/CONFIG_/OPTION_/g;
@@ -46,9 +47,12 @@ while (<>) {
     }
 }
 
-# any options left in @options, are options that were not mentioned in
+# any boolean options left in @options, are options that were not mentioned in
 # the config file, and implicitly that means the option must be set =n,
 # so do that here.
 foreach $opt (@option) {
-    print "OPTION_$opt=n\n";
+    if ($opt =~ /=\s*[yn]/) {
+	$opt =~ s/=\s*[yn]/=n/;
+	print "OPTION_$opt\n";
+    }
 }
diff -Nupbar -X /home/stevel/dontdiff eglibc.menuconfig/libc/scripts/option-groups.awk eglibc/libc/scripts/option-groups.awk
--- eglibc.menuconfig/libc/scripts/option-groups.awk	2011-12-02 09:53:34.997424786 -0800
+++ eglibc/libc/scripts/option-groups.awk	2011-12-07 10:33:36.071240489 -0800
@@ -46,9 +46,15 @@ END {
                 print "#define __" var " 1"
             else if (vars[var] == "n")
                 print "/* #undef __" var " */"
-            # Ignore variables that don't have boolean values.
-            # Ideally, this would be driven by the types given in
-            # option-groups.def.
+	    else if (vars[var] ~ /^[0-9]+/ ||
+		     vars[var] ~ /^0x[0-9aAbBcCdDeEfF]+/ ||
+		     vars[var] ~ /^\"/)
+		 print "#define __" var " " vars[var]
+	    else
+		print "/* #undef __" var " */"
+            # Ignore variables that don't have boolean, int, hex, or
+	    # string values. Ideally, this would be driven by the types
+	    # given in option-groups.def.
         }
     }
 
_______________________________________________
Patches mailing list
Patches@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/patches