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]

[PATCH] Mark MissingArgError, UnknownError and Warn *.opt arguments as gcc-internal-format (PR translation/90041)


Hi!

These 3 *.opt messages are printed using:
opts-common.c:	error_at (loc, option->missing_argument_error, opt);
opts-common.c:	error_at (loc, e->unknown_error, arg);
opts-common.c:    warning_at (loc, 0, decoded->warn_message, opt);
and so they do support the various gcc-internal-format format string
specifiers like %<, %>, %qs etc.

The following patch tweaks exgettext so that it marks them as such
and also adjusts c.opt so that it passes
contrib/check-internal-format-escaping.py after such a change.

Tested on x86_64-linux using make gcc.pot, eyeballing the resulting file
and trying ./xgcc -B ./ -S hello.c -fhandle-exceptions

Ok for trunk?

2019-04-11  Jakub Jelinek  <jakub@redhat.com>

	PR translation/90041
	* po/exgettext: Print MissingArgError, UnknownError or Warn
	*.opt argument using error or warning instead of _ to mark it
	as gcc-internal-format.

	* c.opt (-fhandle-exceptions): Use %< and %> around option names
	in the Warn diagnostics.

--- gcc/po/exgettext.jj	2019-01-01 12:37:21.728899953 +0100
+++ gcc/po/exgettext	2019-04-11 13:39:14.361331358 +0200
@@ -252,7 +252,7 @@ echo "scanning option files..." >&2
 		} else
 			sub("\\).*", "", line)
 		printf("#line %d \"%s\"\n", lineno, file)
-		printf("_(\"%s\")\n", line)
+		printf("error(\"%s\")\n", line)
 	    }
 	    if ((field == 1) && /UnknownError/) {
 		line = $0
@@ -263,7 +263,7 @@ echo "scanning option files..." >&2
 		} else
 			sub("\\).*", "", line)
 		printf("#line %d \"%s\"\n", lineno, file)
-		printf("_(\"%s\")\n", line)
+		printf("error(\"%s\")\n", line)
 	    }
 	    if ((field == 1) && /Warn\(/) {
 		line = $0
@@ -274,7 +274,7 @@ echo "scanning option files..." >&2
 		} else
 			sub("\\).*", "", line)
 		printf("#line %d \"%s\"\n", lineno, file)
-		printf("_(\"%s\")\n", line)
+		printf("warning(0, \"%s\")\n", line)
 	    }
 	    if (field == 2) {
 		line = $0
--- gcc/c-family/c.opt.jj	2019-03-22 15:39:58.149990452 +0100
+++ gcc/c-family/c.opt	2019-04-11 14:06:38.234474269 +0200
@@ -1516,7 +1516,7 @@ fguiding-decls
 C++ ObjC++ Deprecated
 
 fhandle-exceptions
-C++ ObjC++ Optimization Alias(fexceptions) Warn({-fhandle-exceptions has been renamed -fexceptions (and is now on by default)})
+C++ ObjC++ Optimization Alias(fexceptions) Warn({%<-fhandle-exceptions%> has been renamed %<-fexceptions%> (and is now on by default)})
 
 fhonor-std
 C++ ObjC++ Deprecated

	Jakub


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