Patchwork Fix Tru64 UNIX bootstrap: use lbasename in toplev.c (output_stack_usage)

login
register
mail settings
Submitter Rainer Orth
Date Sept. 6, 2010, 4:16 p.m.
Message ID <yddfwxmzw23.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/63947/
State New
Headers show

Comments

Rainer Orth - Sept. 6, 2010, 4:16 p.m.
Mainline bootstrap is currently broken on alpha-dec-osf5.1b due to this
patch:

2010-08-30  Eric Botcazou  <ebotcazou@adacore.com>

	Stack usage support
[...]
	* toplev.c (stack_usage_file): New file pointer.
	(output_stack_usage): New function.

/vol/gcc/src/hg/trunk/local/gcc/toplev.c: In function 'output_stack_usage':
/vol/gcc/src/hg/trunk/local/gcc/toplev.c:1647:5: error: passing argument 1 of 'basename' discards 'const' qualifier from pointer target type [-Werror]
/vol/gcc/obj/regression/trunk/5.1b-gcc/build/./prev-gcc/include-fixed/string.h:174:18: note: expected 'char *' but argument is of type 'const char *'
cc1: all warnings being treated as errors

make[3]: *** [toplev.o] Error 1

In output_stack_usage(), basename is called with loc.file, which is
const char *, while the prototype in <string.h> expects a char *.  I
suppose other platforms aren't affected since they don't have the
prototype in <string.h>, but only in <libgen.h>.

To avoid eventual ripple effects from changing struct
expanded_location.file to char *, I've chosen to simply use libiberty's
lbasename function, which takes a const char *.

Tru64 UNIX V5.1B bootstrap is now past the error, will commit as obvious
once it completes.

	Rainer


2010-09-06  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* toplev.c (output_stack_usage): Use lbasename instead of
	basename.
Eric Botcazou - Sept. 6, 2010, 6:23 p.m.
> 2010-09-06  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>
> 	* toplev.c (output_stack_usage): Use lbasename instead of
> 	basename.

Thanks for fixing this!

Patch

diff -r 9ee93616430f gcc/toplev.c
--- a/gcc/toplev.c	Fri Sep 03 19:11:43 2010 +0200
+++ b/gcc/toplev.c	Mon Sep 06 18:16:03 2010 +0200
@@ -1644,7 +1644,7 @@ 
 
   fprintf (stack_usage_file,
 	   "%s:%d:%d:%s\t"HOST_WIDE_INT_PRINT_DEC"\t%s\n",
-	   basename (loc.file),
+	   lbasename (loc.file),
 	   loc.line,
 	   loc.column,
 	   id,