* Compiling pdumper.c fails with gcc 4.7.2
@ 2019-01-23 9:10 martin rudalics
2019-01-23 13:48 ` Robert Pluim
2019-01-23 15:41 ` Eli Zaretskii
0 siblings, 2 replies; 6+ messages in thread
From: martin rudalics @ 2019-01-23 9:10 UTC (permalink / raw)
To: emacs-devel
With gcc 4.7.2 compiling pdumper.c fails thusly:
CC pdumper.o
../../src/pdumper.c: In function ‘emacs_offset’:
../../src/pdumper.c:718:27: error: declaration of ‘emacs_ptr’ shadows a global declaration [-Werror=shadow]
../../src/pdumper.c:710:1: error: shadowed declaration is here [-Werror=shadow]
../../src/pdumper.c: In function ‘dump_emacs_reloc_copy_from_dump’:
../../src/pdumper.c:1559:40: error: declaration of ‘emacs_ptr’ shadows a global declaration [-Werror=shadow]
../../src/pdumper.c:710:1: error: shadowed declaration is here [-Werror=shadow]
../../src/pdumper.c: In function ‘dump_emacs_reloc_immediate’:
../../src/pdumper.c:1589:41: error: declaration of ‘emacs_ptr’ shadows a global declaration [-Werror=shadow]
../../src/pdumper.c:710:1: error: shadowed declaration is here [-Werror=shadow]
../../src/pdumper.c: In function ‘dump_emacs_reloc_immediate_lv’:
../../src/pdumper.c:1616:1: error: declaration of ‘emacs_ptr’ shadows a global declaration [-Werror=shadow]
../../src/pdumper.c:710:1: error: shadowed declaration is here [-Werror=shadow]
../../src/pdumper.c: In function ‘dump_emacs_reloc_immediate_ptrdiff_t’:
../../src/pdumper.c:1617:1: error: declaration of ‘emacs_ptr’ shadows a global declaration [-Werror=shadow]
../../src/pdumper.c:710:1: error: shadowed declaration is here [-Werror=shadow]
../../src/pdumper.c: In function ‘dump_emacs_reloc_immediate_emacs_int’:
../../src/pdumper.c:1618:1: error: declaration of ‘emacs_ptr’ shadows a global declaration [-Werror=shadow]
../../src/pdumper.c:710:1: error: shadowed declaration is here [-Werror=shadow]
../../src/pdumper.c: In function ‘dump_emacs_reloc_immediate_int’:
../../src/pdumper.c:1619:1: error: declaration of ‘emacs_ptr’ shadows a global declaration [-Werror=shadow]
../../src/pdumper.c:710:1: error: shadowed declaration is here [-Werror=shadow]
../../src/pdumper.c: In function ‘dump_emacs_reloc_immediate_bool’:
../../src/pdumper.c:1620:1: error: declaration of ‘emacs_ptr’ shadows a global declaration [-Werror=shadow]
../../src/pdumper.c:710:1: error: shadowed declaration is here [-Werror=shadow]
../../src/pdumper.c: In function ‘dump_emacs_reloc_to_dump_ptr_raw’:
../../src/pdumper.c:1626:47: error: declaration of ‘emacs_ptr’ shadows a global declaration [-Werror=shadow]
../../src/pdumper.c:710:1: error: shadowed declaration is here [-Werror=shadow]
../../src/pdumper.c: In function ‘dump_emacs_reloc_to_lv’:
../../src/pdumper.c:1645:38: error: declaration of ‘emacs_ptr’ shadows a global declaration [-Werror=shadow]
../../src/pdumper.c:710:1: error: shadowed declaration is here [-Werror=shadow]
../../src/pdumper.c: In function ‘dump_emacs_reloc_to_emacs_ptr_raw’:
../../src/pdumper.c:1674:42: error: declaration of ‘emacs_ptr’ shadows a global declaration [-Werror=shadow]
../../src/pdumper.c:710:1: error: shadowed declaration is here [-Werror=shadow]
cc1: some warnings being treated as errors
make[1]: *** [pdumper.o] Fehler 1
make[1]: *** Warte auf noch nicht beendete Prozesse...
make[1]: Leaving directory `/home/martin/emacs-git/trunk/obj-opt/src'
make: *** [src] Fehler 2
Is there any practicable way to fix this?
Thanks, martin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Compiling pdumper.c fails with gcc 4.7.2
2019-01-23 9:10 Compiling pdumper.c fails with gcc 4.7.2 martin rudalics
@ 2019-01-23 13:48 ` Robert Pluim
2019-01-24 9:05 ` martin rudalics
2019-01-23 15:41 ` Eli Zaretskii
1 sibling, 1 reply; 6+ messages in thread
From: Robert Pluim @ 2019-01-23 13:48 UTC (permalink / raw)
To: martin rudalics; +Cc: emacs-devel
martin rudalics <rudalics@gmx.at> writes:
> With gcc 4.7.2 compiling pdumper.c fails thusly:
>
> CC pdumper.o
> ../../src/pdumper.c: In function ‘emacs_offset’:
> ../../src/pdumper.c:718:27: error: declaration of ‘emacs_ptr’ shadows a global declaration [-Werror=shadow]
> ../../src/pdumper.c:710:1: error: shadowed declaration is here [-Werror=shadow]
>
> Is there any practicable way to fix this?
Sure, the emacs_ptr function is static, so it can change name easily
enough. Something like the following works for me:
diff --git i/src/pdumper.c w/src/pdumper.c
index 6be26dc816..c79034df79 100644
--- i/src/pdumper.c
+++ w/src/pdumper.c
@@ -707,7 +707,7 @@ emacs_basis (void)
}
static void *
-emacs_ptr (const ptrdiff_t offset)
+offset_to_emacs_ptr (const ptrdiff_t offset)
{
/* TODO: assert somehow that the result is actually in the Emacs
image. */
@@ -5330,24 +5330,24 @@ dump_do_emacs_relocation (
{
case RELOC_EMACS_COPY_FROM_DUMP:
eassume (reloc.length > 0);
- memcpy (emacs_ptr (reloc.emacs_offset),
+ memcpy (offset_to_emacs_ptr (reloc.emacs_offset),
dump_ptr (dump_base, reloc.u.dump_offset),
reloc.length);
break;
case RELOC_EMACS_IMMEDIATE:
eassume (reloc.length > 0);
eassume (reloc.length <= sizeof (reloc.u.immediate));
- memcpy (emacs_ptr (reloc.emacs_offset),
+ memcpy (offset_to_emacs_ptr (reloc.emacs_offset),
&reloc.u.immediate,
reloc.length);
break;
case RELOC_EMACS_DUMP_PTR_RAW:
pval = reloc.u.dump_offset + dump_base;
- memcpy (emacs_ptr (reloc.emacs_offset), &pval, sizeof (pval));
+ memcpy (offset_to_emacs_ptr (reloc.emacs_offset), &pval, sizeof (pval));
break;
case RELOC_EMACS_EMACS_PTR_RAW:
pval = reloc.u.emacs_offset2 + emacs_basis ();
- memcpy (emacs_ptr (reloc.emacs_offset), &pval, sizeof (pval));
+ memcpy (offset_to_emacs_ptr (reloc.emacs_offset), &pval, sizeof (pval));
break;
case RELOC_EMACS_DUMP_LV:
case RELOC_EMACS_EMACS_LV:
@@ -5356,12 +5356,12 @@ dump_do_emacs_relocation (
eassume (reloc.length <= Lisp_Float);
void *obj_ptr = reloc.type == RELOC_EMACS_DUMP_LV
? dump_ptr (dump_base, reloc.u.dump_offset)
- : emacs_ptr (reloc.u.emacs_offset2);
+ : offset_to_emacs_ptr (reloc.u.emacs_offset2);
if (reloc.length == Lisp_Symbol)
lv = make_lisp_symbol (obj_ptr);
else
lv = make_lisp_ptr (obj_ptr, reloc.length);
- memcpy (emacs_ptr (reloc.emacs_offset), &lv, sizeof (lv));
+ memcpy (offset_to_emacs_ptr (reloc.emacs_offset), &lv, sizeof (lv));
break;
}
default:
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: Compiling pdumper.c fails with gcc 4.7.2
2019-01-23 9:10 Compiling pdumper.c fails with gcc 4.7.2 martin rudalics
2019-01-23 13:48 ` Robert Pluim
@ 2019-01-23 15:41 ` Eli Zaretskii
2019-01-24 9:05 ` martin rudalics
1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2019-01-23 15:41 UTC (permalink / raw)
To: martin rudalics; +Cc: emacs-devel
> Date: Wed, 23 Jan 2019 10:10:22 +0100
> From: martin rudalics <rudalics@gmx.at>
>
> With gcc 4.7.2 compiling pdumper.c fails thusly:
>
> CC pdumper.o
> ../../src/pdumper.c: In function ‘emacs_offset’:
> ../../src/pdumper.c:718:27: error: declaration of ‘emacs_ptr’ shadows a global declaration [-Werror=shadow]
> ../../src/pdumper.c:710:1: error: shadowed declaration is here [-Werror=shadow]
> ../../src/pdumper.c: In function ‘dump_emacs_reloc_copy_from_dump’:
> ../../src/pdumper.c:1559:40: error: declaration of ‘emacs_ptr’ shadows a global declaration [-Werror=shadow]
A hilarious GCC bug.
> Is there any practicable way to fix this?
I tried to fix it, please try the latest master.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Compiling pdumper.c fails with gcc 4.7.2
2019-01-23 13:48 ` Robert Pluim
@ 2019-01-24 9:05 ` martin rudalics
2019-01-24 9:28 ` Robert Pluim
0 siblings, 1 reply; 6+ messages in thread
From: martin rudalics @ 2019-01-24 9:05 UTC (permalink / raw)
To: emacs-devel
>> With gcc 4.7.2 compiling pdumper.c fails thusly:
>>
>> CC pdumper.o
>> ../../src/pdumper.c: In function ‘emacs_offset’:
>> ../../src/pdumper.c:718:27: error: declaration of ‘emacs_ptr’ shadows a global declaration [-Werror=shadow]
>> ../../src/pdumper.c:710:1: error: shadowed declaration is here [-Werror=shadow]
>>
>> Is there any practicable way to fix this?
>
> Sure, the emacs_ptr function is static, so it can change name easily
> enough. Something like the following works for me:
Thank you very much. I verified that it would have worked here hadn't
Eli installed a different fix.
martin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Compiling pdumper.c fails with gcc 4.7.2
2019-01-23 15:41 ` Eli Zaretskii
@ 2019-01-24 9:05 ` martin rudalics
0 siblings, 0 replies; 6+ messages in thread
From: martin rudalics @ 2019-01-24 9:05 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
> A hilarious GCC bug.
>
>> Is there any practicable way to fix this?
>
> I tried to fix it, please try the latest master.
Thanks for the fix. Builds now without problems.
martin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Compiling pdumper.c fails with gcc 4.7.2
2019-01-24 9:05 ` martin rudalics
@ 2019-01-24 9:28 ` Robert Pluim
0 siblings, 0 replies; 6+ messages in thread
From: Robert Pluim @ 2019-01-24 9:28 UTC (permalink / raw)
To: martin rudalics; +Cc: emacs-devel
martin rudalics <rudalics@gmx.at> writes:
>>> With gcc 4.7.2 compiling pdumper.c fails thusly:
>>>
>>> CC pdumper.o
>>> ../../src/pdumper.c: In function ‘emacs_offset’:
>>> ../../src/pdumper.c:718:27: error: declaration of ‘emacs_ptr’ shadows a global declaration [-Werror=shadow]
>>> ../../src/pdumper.c:710:1: error: shadowed declaration is here [-Werror=shadow]
>>>
>>> Is there any practicable way to fix this?
>>
>> Sure, the emacs_ptr function is static, so it can change name easily
>> enough. Something like the following works for me:
>
> Thank you very much. I verified that it would have worked here hadn't
> Eli installed a different fix.
Eli chose a better, shorter name than I did :-)
Robert
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-01-24 9:28 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-23 9:10 Compiling pdumper.c fails with gcc 4.7.2 martin rudalics
2019-01-23 13:48 ` Robert Pluim
2019-01-24 9:05 ` martin rudalics
2019-01-24 9:28 ` Robert Pluim
2019-01-23 15:41 ` Eli Zaretskii
2019-01-24 9:05 ` martin rudalics
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).