This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR other/20792: Make gettext process all help strings


Like PR other/20792 says, help strings in the new .opt files are not
picked up by gettext.  The same problem applies to language .opt files
if that language isn't built.

This patch stops gettext from looking at options.c and makes it scan
all .opt files instead.

Bootstrapped & regression tested on i686-pc-linux-gnu.  As expected,
the new gcc.pot includes the target option help strings.  OK to install?

As Joseph says, the fact that "make gcc.pot" relies on all languages
being enabled is a 4.0 regression.  Is the patch OK for 4.0 too?

Richard


gcc/
	PR other/20792
	* Makefile.in (gcc.pot): Remove options.c dependency.
	* optc-gen.awk: Don't quote help strings with N_().

gcc/po/
	PR other/20792
	* exgettext: Don't scan options.c.  Scan .opt files for help strings.
	* gcc.pot: Regenerate.

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1464
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.1464 Makefile.in
--- Makefile.in	6 Apr 2005 11:42:59 -0000	1.1464
+++ Makefile.in	6 Apr 2005 18:54:11 -0000
@@ -4285,7 +4285,7 @@ install-po:
 # fairly modern (POSIX-compliant) awk.
 # The .pot file is left in the build directory.
 gcc.pot: po/gcc.pot
-po/gcc.pot: force options.c
+po/gcc.pot: force
 	-test -d po || mkdir po
 	$(MAKE) srcextra
 	AWK=$(AWK) $(SHELL) $(srcdir)/po/exgettext \
Index: optc-gen.awk
===================================================================
RCS file: /cvs/gcc/gcc/gcc/optc-gen.awk,v
retrieving revision 2.2
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r2.2 optc-gen.awk
--- optc-gen.awk	30 Mar 2005 06:24:35 -0000	2.2
+++ optc-gen.awk	6 Apr 2005 18:54:11 -0000
@@ -126,7 +126,7 @@ for (i = 0; i < n_opts; i++)
 		if (help[i] == "")
 			hlp = "0"
 		else
-			hlp = "N_(" quote help[i] quote ")";
+			hlp = quote help[i] quote;
 
 		printf("  { %c-%s%c,\n    %s,\n    %s, %u, %s, %s, %s }%s\n",
 			quote, opts[i], quote, hlp, back_chain[i], len,
Index: po/exgettext
===================================================================
RCS file: /cvs/gcc/gcc/gcc/po/exgettext,v
retrieving revision 1.10
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.10 exgettext
--- po/exgettext	9 Nov 2004 21:57:17 -0000	1.10
+++ po/exgettext	6 Apr 2005 18:54:11 -0000
@@ -58,9 +58,6 @@ kopt=$pwd/$T/keyword-options
 emsg=$pwd/$T/emsgids.c
 posr=$pwd/$T/po-sources
 
-# Extra files to scan
-extra_files=$pwd/options.c
-
 # Locate files to scan, and generate the list.  All .c, .h, and .def files
 # in $srcdir are examined, likewise $srcdir/config and $srcdir/config/*
 # (directories).  Also, all subdirectories of $srcdir that contain a
@@ -83,7 +80,6 @@ ( cd $srcdir
         do  eval echo $dir$glob
         done
     done;
-    echo $extra_files;
   } | tr ' ' "$nl" | grep -v '\*' |
   $AWK -v excl=po/EXCLUDES -v posr=$posr -v kopt=$kopt -v emsg=$emsg '
 function keyword_option(line) {
@@ -161,6 +157,29 @@ END {
 }'
 )
 
+echo "scanning option files..." >&2
+
+( cd $srcdir; find . -name '*.opt' -print |
+  $AWK '{
+    file = $1
+    lineno = 1
+    field = 0
+    while (getline < file) {
+	if (/^[ \t]*(;|$)/ || !/^[^ \t]/) {
+	    field = 0
+	} else {
+	    if (field == 2) {
+		line = $0
+		gsub(".*\t", "", line)
+		printf("#line %d \"%s\"\n", lineno, file)
+		printf("_(\"%s\")\n", line)
+	    }
+	    field++;
+	}
+	lineno++;
+    }
+  }') >> $emsg
+
 # Run the xgettext command, with temporary added as a file to scan.
 echo "running xgettext..." >&2
 $xgettext --default-domain=$package --directory=$srcdir \


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]