diff options
author | Marco Poletti <poletti.marco@gmail.com> | 2010-02-14 19:44:07 +0000 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2010-02-14 19:44:07 +0000 |
commit | 0f667308a96b55574e8d024a0483a1cca100bce1 (patch) | |
tree | dcd9083bb8ddcca54218f5be9eb599e62829664f | |
parent | e4a20ced34656f9dee37bce74a07e22e281aa6a9 (diff) | |
download | gcc-0f667308a96b55574e8d024a0483a1cca100bce1.zip gcc-0f667308a96b55574e8d024a0483a1cca100bce1.tar.gz gcc-0f667308a96b55574e8d024a0483a1cca100bce1.tar.bz2 |
intl.c (fake_ngettext): New function.
2010-02-14 Marco Poletti <poletti.marco@gmail.com>
* intl.c (fake_ngettext): New function.
* intl.h (fake_ngettext): Declare.
(ngettext): Define macro.
* collect2.c (notice_translated): New function.
(main): Use notice_translated and ngettext.
* collect2.h (notice_translated): Declare.
From-SVN: r156762
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/collect2.c | 26 | ||||
-rw-r--r-- | gcc/collect2.h | 1 | ||||
-rw-r--r-- | gcc/intl.c | 13 | ||||
-rw-r--r-- | gcc/intl.h | 5 |
5 files changed, 51 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b7f04af..beff68b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2010-02-14 Marco Poletti <poletti.marco@gmail.com> + + * intl.c (fake_ngettext): New function. + * intl.h (fake_ngettext): Declare. + (ngettext): Define macro. + * collect2.c (notice_translated): New function. + (main): Use notice_translated and ngettext. + * collect2.h (notice_translated): Declare. + 2010-02-14 Steven Bosscher <steven@gcc.gnu.org> * reorg.c (delete_computation): Comment fixes. diff --git a/gcc/collect2.c b/gcc/collect2.c index 914015f..120369a 100644 --- a/gcc/collect2.c +++ b/gcc/collect2.c @@ -430,6 +430,17 @@ notice (const char *cmsgid, ...) va_end (ap); } +/* Notify user of a non-error, without translating the format string. */ +void +notice_translated (const char *cmsgid, ...) +{ + va_list ap; + + va_start (ap, cmsgid); + vfprintf (stderr, cmsgid, ap); + va_end (ap); +} + /* Die when sys call fails. */ void @@ -1809,9 +1820,18 @@ main (int argc, char **argv) if (debug) { - notice ("%d constructor(s) found\n", constructors.number); - notice ("%d destructor(s) found\n", destructors.number); - notice ("%d frame table(s) found\n", frame_tables.number); + notice_translated (ngettext ("%d constructor found\n", + "%d constructors found\n", + constructors.number), + constructors.number); + notice_translated (ngettext ("%d destructor found\n", + "%d destructors found\n", + destructors.number), + destructors.number); + notice_translated (ngettext("%d frame table found\n", + "%d frame tables found\n", + frame_tables.number), + frame_tables.number); } /* If the scan exposed nothing of special interest, there's no need to diff --git a/gcc/collect2.h b/gcc/collect2.h index 81113cf..4095734 100644 --- a/gcc/collect2.h +++ b/gcc/collect2.h @@ -41,6 +41,7 @@ extern char *temporary_firstobj; extern int vflag, debug; extern void error (const char *, ...) ATTRIBUTE_PRINTF_1; +extern void notice_translated (const char *, ...) ATTRIBUTE_PRINTF_1; extern void notice (const char *, ...) ATTRIBUTE_PRINTF_1; extern void fatal (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; extern void fatal_perror (const char *, ...) @@ -121,6 +121,19 @@ gcc_gettext_width (const char *msgstr) #endif /* ENABLE_NLS */ +#ifndef ENABLE_NLS + +const char * +fake_ngettext (const char *singular, const char *plural, unsigned long n) +{ + if (n == 1UL) + return singular; + + return plural; +} + +#endif + /* Return the indent for successive lines, using the width of the STR. STR must have been translated already. The string must be freed by the caller. */ @@ -38,8 +38,13 @@ extern size_t gcc_gettext_width (const char *); # define bindtextdomain(domain, directory) (domain) # undef gettext # define gettext(msgid) (msgid) +# define ngettext(singular,plural,n) fake_ngettext(singular,plural,n) # define gcc_init_libintl() /* nothing */ # define gcc_gettext_width(s) strlen(s) + +extern const char *fake_ngettext(const char *singular,const char *plural, + unsigned long int n); + #endif #ifndef _ |