From 64a7d2a1d67866fd94262b97ad906a6589f19aaa Mon Sep 17 00:00:00 2001
From: Murai Takashi <tmurai01@gmail.com>
Date: Sun, 19 Apr 2015 17:56:19 +0900
Subject: [PATCH 1/6] Fix GCC 5 build.
* Add -fgnu89-inline flag for libroot/posix/glibc
* Change __GNUC__ == 4 to __GNUC__ >= 4
---
build/jam/ArchitectureRules | 8 ++++++++
headers/build/os/BeBuild.h | 2 +-
headers/os/BeBuild.h | 2 +-
headers/private/kernel/util/AutoLock.h | 2 +-
headers/private/media/ServerInterface.h | 2 +-
src/kits/interface/Rect.cpp | 4 ++--
src/system/runtime_loader/elf_load_image.cpp | 2 +-
7 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules
index 81d137a..ab454bc 100644
a
|
b
|
rule ArchitectureSetupWarnings architecture
|
470 | 470 | WARNINGS on $(file) = $(WARNINGS) ; |
471 | 471 | } |
472 | 472 | |
| 473 | if $(gccVersion[1]) = 5 { |
| 474 | # We need -fgnu89-inline, as GCC5 changed 'extern inline' semantics. |
| 475 | # Please see https://gcc.gnu.org/gcc-5/porting_to.html . |
| 476 | AppendToConfigVar CCFLAGS : |
| 477 | HAIKU_TOP src system libroot posix glibc : |
| 478 | -fgnu89-inline : global ; |
| 479 | } |
| 480 | |
473 | 481 | if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 { |
474 | 482 | # We need -integrated-as, as otherwise Clang uses GCC as assembler and |
475 | 483 | # passes -fheinous-gnu-extensions to GCC, which GCC does not understand |
diff --git a/headers/build/os/BeBuild.h b/headers/build/os/BeBuild.h
index 3130e03..11a1cd8 100644
a
|
b
|
|
37 | 37 | |
38 | 38 | #if __GNUC__ == 2 |
39 | 39 | # define B_HAIKU_ABI B_HAIKU_ABI_GCC_2_HAIKU |
40 | | #elif __GNUC__ == 3 || __GNUC__ == 4 |
| 40 | #elif __GNUC__ == 3 || __GNUC__ >= 4 |
41 | 41 | # define B_HAIKU_ABI B_HAIKU_ABI_GCC_4 |
42 | 42 | #else |
43 | 43 | # error Unsupported gcc version! |
diff --git a/headers/os/BeBuild.h b/headers/os/BeBuild.h
index 509ccf5..5fe41f4 100644
a
|
b
|
|
45 | 45 | |
46 | 46 | #if __GNUC__ == 2 |
47 | 47 | # define B_HAIKU_ABI B_HAIKU_ABI_GCC_2_HAIKU |
48 | | #elif __GNUC__ == 4 |
| 48 | #elif __GNUC__ >= 4 |
49 | 49 | # define B_HAIKU_ABI B_HAIKU_ABI_GCC_4 |
50 | 50 | #else |
51 | 51 | # error Unsupported gcc version! |
diff --git a/headers/private/kernel/util/AutoLock.h b/headers/private/kernel/util/AutoLock.h
index 3151065..f724503 100644
a
|
b
|
class InterruptsSpinLocking {
|
132 | 132 | public: |
133 | 133 | // NOTE: work-around for annoying GCC 4 "fState may be used uninitialized" |
134 | 134 | // warning. |
135 | | #if __GNUC__ == 4 |
| 135 | #if __GNUC__ >= 4 |
136 | 136 | InterruptsSpinLocking() |
137 | 137 | : |
138 | 138 | fState(0) |
diff --git a/headers/private/media/ServerInterface.h b/headers/private/media/ServerInterface.h
index 13249eb..d8bebc6 100644
a
|
b
|
struct reply_data {
|
180 | 180 | struct command_data { |
181 | 181 | // yes, it's empty ;) |
182 | 182 | |
183 | | #if __GNUC__ == 4 |
| 183 | #if __GNUC__ >= 4 |
184 | 184 | int32 _padding; |
185 | 185 | // GCC 2 and GCC 4 treat empty structures differently |
186 | 186 | #endif |
diff --git a/src/kits/interface/Rect.cpp b/src/kits/interface/Rect.cpp
index 06d4e38..3c9a0d6 100644
a
|
b
|
OffsetToCopy__5BRectff(BRect* self, float dx, float dy)
|
332 | 332 | } |
333 | 333 | |
334 | 334 | |
335 | | #elif __GNUC__ == 4 |
| 335 | #elif __GNUC__ >= 4 |
336 | 336 | // TODO: remove this when new GCC 4 packages have to be built anyway |
337 | 337 | |
338 | 338 | |
… |
… |
_ZN5BRect12OffsetToCopyEff(BRect* self, float dx, float dy)
|
390 | 390 | } |
391 | 391 | |
392 | 392 | |
393 | | #endif // __GNUC__ == 4 |
| 393 | #endif // __GNUC__ >= 4 |
diff --git a/src/system/runtime_loader/elf_load_image.cpp b/src/system/runtime_loader/elf_load_image.cpp
index 0110948..cfa4e34 100644
a
|
b
|
load_image(char const* name, image_type type, const char* rpath,
|
552 | 552 | #if __GNUC__ == 2 |
553 | 553 | if ((image->abi & B_HAIKU_ABI_MAJOR) == B_HAIKU_ABI_GCC_4) |
554 | 554 | sSearchPathSubDir = "x86"; |
555 | | #elif __GNUC__ == 4 |
| 555 | #elif __GNUC__ >= 4 |
556 | 556 | if ((image->abi & B_HAIKU_ABI_MAJOR) == B_HAIKU_ABI_GCC_2) |
557 | 557 | sSearchPathSubDir = "x86_gcc2"; |
558 | 558 | #endif |