⛏️ index : buildtools.git

author Franck LeCodeur <cassisian@gmail.com> 2021-08-27 20:32:28.0 +02:00:00
committer Jérôme Duval <jerome.duval@gmail.com> 2021-09-02 19:32:44.0 +00:00:00
commit
f5c73e1b9072b5b40d49c01462dd71541cdb6a65 [patch]
tree
34c5915d8dea0444a6fbdf7ece7e95c6a56401ac
parent
1673cf9c0fa660dd45292b0413481b7bb3182f5d
download
f5c73e1b9072b5b40d49c01462dd71541cdb6a65.tar.gz

jam: Fix build warning. Correct expression.

Pointer to struct on stack was given instead of the calculated value.

Warning was:

Cc bin.linuxx86/expand.o
expand.c: In function ‘var_expand’:
expand.c:210:49: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘LIST *’ {aka ‘struct _list *’} [-Wformat=]
  210 |       printf("MAXSYM is too low! Need at least %d\n", l);
      |                                                ~^     ~
      |                                                 |     |
      |                                                 int   LIST * {aka struct _list *}

Change-Id: I65ab593287fc1b9aa2aba0056714726e29467012
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4398
Reviewed-by: John Scipione <jscipione@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>

Diff

 jam/expand.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/jam/expand.c b/jam/expand.c
index faadf13..b6ef564 100644
--- a/jam/expand.c
+++ a/jam/expand.c
@@ -206,10 +206,14 @@
		/* Look for a : modifier in the variable name */
		/* Must copy into varname so we can modify it */

		if (strlen(vars->string) > MAXSYM) {
		    printf("MAXSYM is too low! Need at least %d\n", l);
		    exit(-1);
		size_t varname_len = strlen(vars->string);
		if( varname_len > MAXSYM )
		{
		    printf( "MAXSYM is too low! Need at least %zu\n",
		        varname_len );
		    exit( -1 );
		}

		strcpy( varname, vars->string );

		if( colon = strchr( varname, MAGIC_COLON ) )
@@ -278,10 +282,12 @@
		    LIST *rem;
		    char *out1;

		    if (out - out_buf > MAXSYM) {
			printf("MAXSYM is too low!\n");
			exit(-1);
		    if( out - out_buf > MAXSYM )
		    {
		        printf( "MAXSYM is too low!\n" );
		        exit( -1 );
		    }

		    /* Handle end subscript (length actually) */

		    if( sub2 >= 0 && --sub2 < 0 )