This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [options]: Start moving help text to .opt files
Neil Booth <neil@daikokuya.co.uk> writes:
> static void
> wrap_help (const char *help, const char *item, size_t item_width)
item_width is still size_t and therefore I get:
/cvs/gcc/gcc/opts.c: In function `wrap_help':
/cvs/gcc/gcc/opts.c:1554: warning: field precision is not type int (arg 3)
make[2]: *** [opts.o] Error 1
> {
> - const size_t columns = 80, col_width = 27;
> - size_t remaining, room, len;
> + const unsigned int columns = 80, col_width = 27;
> + unsigned int remaining, room, len;
Accord to ISO C99 7.19.6.1 the '*' takes an int and not an unsigned
int, so let's remove the unsigned above.
>
> remaining = strlen (help);
>
> @@ -1538,7 +1538,7 @@ wrap_help (const char *help, const char
>
> if (room < len)
> {
> - size_t i;
> + unsigned int i;
>
> for (i = 0; help[i]; i++)
> {
>
>
I'm appending a patch to fix this and commit it as obvious now. I've
tested on x86_64-linux,
Andreas
2003-07-09 Andreas Jaeger <aj@suse.de>
* opts.c (wrap_help): Only pass int arguments as arguments to
printf's '*' modifier. Change argument of function.
============================================================
Index: gcc/opts.c
--- gcc/opts.c 8 Jul 2003 21:36:33 -0000 1.26
+++ gcc/opts.c 9 Jul 2003 05:11:14 -0000
@@ -137,7 +137,7 @@ static char *write_langs (unsigned int l
static void complain_wrong_lang (const char *, const struct cl_option *,
unsigned int lang_mask);
static void handle_options (unsigned int, const char **, unsigned int);
-static void wrap_help (const char *help, const char *item, size_t item_width);
+static void wrap_help (const char *help, const char *item, int item_width);
static void print_help (void);
/* Perform a binary search to find which option the command-line INPUT
@@ -1524,9 +1524,9 @@ print_help (void)
/* Output ITEM, of length ITEM_WIDTH, in the left column, followed by
word-wrapped HELP in a second column. */
static void
-wrap_help (const char *help, const char *item, size_t item_width)
+wrap_help (const char *help, const char *item, int item_width)
{
- const unsigned int columns = 80, col_width = 27;
+ const int columns = 80, col_width = 27;
unsigned int remaining, room, len;
remaining = strlen (help);
--
Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126