Closed Bug 1635803 Opened 5 years ago Closed 5 years ago

error: exception specification in declaration does not match previous declaration malloc|calloc|realloc on Fedroa 32

Categories

(Firefox Build System :: General, defect)

defect

Tracking

(firefox76 unaffected, firefox77 unaffected, firefox78 fixed)

RESOLVED FIXED
mozilla78
Tracking Status
firefox76 --- unaffected
firefox77 --- unaffected
firefox78 --- fixed

People

(Reporter: bc, Assigned: mstange)

References

(Regression)

Details

(Keywords: regression)

Attachments

(3 files)

I recently updated to Fedora 32 and was able to perform builds afterwards. It began failing this morning with

 1:08.75 In file included from Unified_cpp_mozglue_baseprofiler1.cpp:2:
 1:08.75 In file included from /home/bclary/mozilla/builds/autoland/mozilla/mozglue/baseprofiler/lul/LulElf.cpp:58:
 1:08.75 In file included from /home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/stl_wrappers/set:58:
 1:08.75 In file included from /home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/mozilla/mozalloc.h:36:
 1:08.75 In file included from /home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/stl_wrappers/cstdlib:52:
 1:08.75 In file included from /home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/system_wrappers/cstdlib:3:
 1:08.75 In file included from /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/cstdlib:75:
 1:08.75 /usr/include/stdlib.h:539:14: error: exception specification in declaration does not match previous declaration
 1:08.75 extern void *malloc (size_t __size) __THROW __attribute_malloc__
 1:08.75              ^
 1:08.75 /home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/malloc_decls.h:51:1: note: previous declaration is here
 1:08.75 MALLOC_DECL(malloc, void*, size_t)
 1:08.75 ^
 1:08.75 /home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/mozilla/mozalloc.h:22:32: note: expanded from macro 'MALLOC_DECL'
 1:08.75     MOZ_MEMORY_API return_type name##_impl(__VA_ARGS__);
 1:08.75                                ^
 1:08.75 <scratch space>:431:1: note: expanded from here
 1:08.75 malloc_impl
 1:08.75 ^
 1:08.75 /home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/mozmemory_wrap.h:138:40: note: expanded from macro 'malloc_impl'
 1:08.75 #define malloc_impl mozmem_malloc_impl(malloc)
 1:08.75                                        ^
 1:08.75 In file included from Unified_cpp_mozglue_baseprofiler1.cpp:2:
 1:08.75 In file included from /home/bclary/mozilla/builds/autoland/mozilla/mozglue/baseprofiler/lul/LulElf.cpp:58:
 1:08.75 In file included from /home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/stl_wrappers/set:58:
 1:08.75 In file included from /home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/mozilla/mozalloc.h:36:
 1:08.75 In file included from /home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/stl_wrappers/cstdlib:52:
 1:08.75 In file included from /home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/system_wrappers/cstdlib:3:
 1:08.75 In file included from /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/cstdlib:75:
 1:08.75 /usr/include/stdlib.h:542:14: error: exception specification in declaration does not match previous declaration
 1:08.75 extern void *calloc (size_t __nmemb, size_t __size)
 1:08.75              ^
 1:08.75 /home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/malloc_decls.h:52:1: note: previous declaration is here
 1:08.75 MALLOC_DECL(calloc, void*, size_t, size_t)
 1:08.75 ^
 1:08.75 /home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/mozilla/mozalloc.h:22:32: note: expanded from macro 'MALLOC_DECL'
 1:08.75     MOZ_MEMORY_API return_type name##_impl(__VA_ARGS__);
 1:08.75                                ^
 1:08.75 <scratch space>:432:1: note: expanded from here
 1:08.75 calloc_impl
 1:08.75 ^
 1:08.75 /home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/mozmemory_wrap.h:141:40: note: expanded from macro 'calloc_impl'
 1:08.75 #define calloc_impl mozmem_malloc_impl(calloc)
 1:08.75                                        ^
 1:08.75 In file included from Unified_cpp_mozglue_baseprofiler1.cpp:2:
 1:08.75 In file included from /home/bclary/mozilla/builds/autoland/mozilla/mozglue/baseprofiler/lul/LulElf.cpp:58:
 1:08.75 In file included from /home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/stl_wrappers/set:58:
 1:08.75 In file included from /home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/mozilla/mozalloc.h:36:
 1:08.75 In file included from /home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/stl_wrappers/cstdlib:52:
 1:08.75 In file included from /home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/system_wrappers/cstdlib:3:
 1:08.75 In file included from /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/cstdlib:75:
 1:08.75 /usr/include/stdlib.h:550:14: error: exception specification in declaration does not match previous declaration
 1:08.75 extern void *realloc (void *__ptr, size_t __size)
 1:08.75              ^
 1:08.75 /home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/malloc_decls.h:53:1: note: previous declaration is here
 1:08.76 MALLOC_DECL(realloc, void*, void*, size_t)
 1:08.76 ^
 1:08.76 /home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/mozilla/mozalloc.h:22:32: note: expanded from macro 'MALLOC_DECL'
 1:08.76     MOZ_MEMORY_API return_type name##_impl(__VA_ARGS__);
 1:08.76                                ^
 1:08.76 <scratch space>:433:1: note: expanded from here
 1:08.76 realloc_impl
 1:08.76 ^
 1:08.76 /home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/mozmemory_wrap.h:142:41: note: expanded from macro 'realloc_impl'
 1:08.76 #define realloc_impl mozmem_malloc_impl(realloc)
 1:08.76                                         ^

I believe it bisected it to

The first bad revision is:
changeset:   530096:aea741f601bd
user:        Markus Stange <mstange@themasta.com>
date:        Tue May 05 22:00:49 2020 +0000
summary:     Bug 1634784 - Remove #ifdef MOZ_GECKO_PROFILER wrappers in mozglue/baseprofiler cpp files, and reorder includes. r=gerald

Thanks! Could you run ./mach build objdir/mozglue/baseprofiler/Unified_cpp_mozglue_baseprofiler1.i and attach the generated Unified_cpp_mozglue_baseprofiler1.i file? Also, could you try reverting just the LulElf.cpp hunk ( https://hg.mozilla.org/mozilla-central/diff/aea741f601bdd780aa5ce08d584dbae822a35f46/mozglue/baseprofiler/lul/LulElf.cpp ) and see whether that fixes the issue?

Flags: needinfo?(bob)

Yes, backing that out did fix the issue.

Flags: needinfo?(bob)

Thanks! I looked through the log but couldn't find the answer to why this issue didn't appear before. Could you generate the same file again, but with that hunk backed out?

Flags: needinfo?(bob)

Here are the two inclusion paths, with the final substitution result. Glandium, any ideas? Did the "BaseProfiler.h" include set a #define that magically worked around this error?

# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "Unified_cpp_mozglue_baseprofiler1.cpp" 2
# 1 "/home/bclary/mozilla/builds/autoland/mozilla/mozglue/baseprofiler/lul/LulElf.cpp" 1
# 1 "/home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/stl_wrappers/set" 1
# 1 "/home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/mozilla/mozalloc.h" 1 3
# 1 "/home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/malloc_decls.h" 1 3
# 51 "/home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/malloc_decls.h" 3

extern "C" __attribute__((visibility("default"))) void* malloc(size_t);

and then

# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "Unified_cpp_mozglue_baseprofiler1.cpp" 2
# 1 "/home/bclary/mozilla/builds/autoland/mozilla/mozglue/baseprofiler/lul/LulElf.cpp" 1
# 1 "/home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/stl_wrappers/set" 1
# 1 "/home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/mozilla/mozalloc.h" 1 3
# 1 "/home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/stl_wrappers/cstdlib" 1 3
# 1 "/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/cstdlib" 1 3
# 1 "/usr/include/stdlib.h" 1 3 4
# 395 "/usr/include/stdlib.h" 2 3 4

extern void *malloc (size_t __size) throw () __attribute__ ((__malloc__))
                                    __attribute__ ((__warn_unused_result__));
Flags: needinfo?(mh+mozilla)

after reverting LulElf.cpp

Flags: needinfo?(bob)

Heh, it's the same two malloc declarations, but with the order reversed.

# 1 "/home/bclary/mozilla/builds/autoland/mozilla/mozglue/baseprofiler/lul/LulElf.cpp" 1
# 1 "/home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/BaseProfiler.h" 1
# 1 "/home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/mozilla/BaseProfilerCounts.h" 1
# 1 "/home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/mozilla/Atomics.h" 1
# 1 "/home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/mozilla/Assertions.h" 1
# 1 "/home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/system_wrappers/stdlib.h" 1
# 1 "/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/stdlib.h" 1 3
# 1 "/home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/stl_wrappers/cstdlib" 1 3
# 1 "/home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/system_wrappers/cstdlib" 
# 1 "/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/cstdlib" 1 3
# 1 "/usr/include/stdlib.h" 1 3 4
# 395 "/usr/include/stdlib.h" 2 3 4

extern void *malloc (size_t __size) throw () __attribute__ ((__malloc__))
                                    __attribute__ ((__warn_unused_result__));

and then

...
# 1 "/home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/mozilla/Atomics.h" 1
# 1 "/home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/stl_wrappers/atomic" 1
# 1 "/home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/mozilla/mozalloc.h" 1 3
# 1 "/home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/malloc_decls.h" 1 3
# 51 "/home/bclary/mozilla/builds/autoland/mozilla/firefox-opt/dist/include/malloc_decls.h" 3

extern "C" __attribute__((visibility("default"))) void* malloc(size_t);

Glandium, what does this mean? Does it mean that leaving out the "throw()" the second time is ok, but adding it is not?

Bob, does this patch also fix the issue?

diff --git a/mozglue/baseprofiler/lul/LulElf.cpp b/mozglue/baseprofiler/lul/LulElf.cpp
--- a/mozglue/baseprofiler/lul/LulElf.cpp
+++ b/mozglue/baseprofiler/lul/LulElf.cpp
@@ -50,16 +50,17 @@
 #include <libgen.h>
 #include <stdio.h>
 #include <string.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <arpa/inet.h>

+#include <cstdlib>
 #include <set>
 #include <string>
 #include <vector>

 #include "mozilla/Assertions.h"
 #include "mozilla/Sprintf.h"

 #include "PlatformMacros.h"
Flags: needinfo?(bob)

yep. \o/

Flags: needinfo?(bob)
Flags: needinfo?(mh+mozilla)

Great! I've filed bug 1635968 on the underlying issue and will use this bug to land the workaround.

Assignee: nobody → mstange
Status: NEW → ASSIGNED
Pushed by mstange@themasta.com: https://hg.mozilla.org/integration/autoland/rev/f4e543221ab1 Make sure <cstdlib> is included before mozalloc.h, to work around bug 1635968. r=gerald
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78

Set release status flags based on info from the regressing bug 1634784

Has Regression Range: --- → yes
Keywords: regression
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: