From c59b279b7173bcafb8f266aa753b2f9e6c578849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Thu, 19 Jan 2012 19:44:42 +0100 Subject: [PATCH] Added workarounds and options for gcc 4.6.2 * add -Wno-unused-but-set-variable for gcc 4.6.x with a TODO * fix warnings about wrong size of pointer cast in ioapic.cpp and AudioBuffer.cpp --- build/jam/BuildSetup | 28 +++++++++---------- build/scripts/build_cross_tools_gcc4 | 2 +- src/apps/cortex/addons/common/AudioBuffer.cpp | 4 +-- src/system/kernel/arch/x86/ioapic.cpp | 4 +-- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup index c46977e685..32884292a5 100644 --- a/build/jam/BuildSetup +++ b/build/jam/BuildSetup @@ -1185,24 +1185,24 @@ AUTO_SET_UP_CONFIG_VARIABLES += # enable -Werror for certain parts of the source tree - -if $(HAIKU_GCC_VERSION[1]) = 2 { - rule EnableWerror dirTokens : scope { - AppendToConfigVar CCFLAGS : HAIKU_TOP $(dirTokens) : -Werror - : $(scope) ; - AppendToConfigVar C++FLAGS : HAIKU_TOP $(dirTokens) : -Werror - : $(scope) ; - } -} else { +HAIKU_WERRORFLAGS = ; +if $(HAIKU_GCC_VERSION[1]) >= 4 { # -Wuninitialized gives too many false positives. - rule EnableWerror dirTokens : scope { - AppendToConfigVar CCFLAGS : HAIKU_TOP $(dirTokens) - : -Werror -Wno-error=uninitialized : $(scope) ; - AppendToConfigVar C++FLAGS : HAIKU_TOP $(dirTokens) - : -Werror -Wno-error=uninitialized : $(scope) ; + HAIKU_WERRORFLAGS = -Wno-error=uninitialized ; + + if $(HAIKU_GCC_VERSION[2]) >= 6 { + # TODO: remove the -Wno-unused-but-set-variable option + HAIKU_WERRORFLAGS += -Wno-unused-but-set-variable ; } } +rule EnableWerror dirTokens : scope { + AppendToConfigVar CCFLAGS : HAIKU_TOP $(dirTokens) + : -Werror $(HAIKU_WERRORFLAGS) : $(scope) ; + AppendToConfigVar C++FLAGS : HAIKU_TOP $(dirTokens) + : -Werror $(HAIKU_WERRORFLAGS) : $(scope) ; +} + # Work-around for GCC 2 problem -- despite -Wno-multichar it reports # multichar warnings in headers/private/kernel/debugger_keymaps.h included by # src/system/kernel/arch/x86/arch_debug_console.cpp. diff --git a/build/scripts/build_cross_tools_gcc4 b/build/scripts/build_cross_tools_gcc4 index fa20f7c601..3c4ba83491 100755 --- a/build/scripts/build_cross_tools_gcc4 +++ b/build/scripts/build_cross_tools_gcc4 @@ -144,7 +144,7 @@ copy_headers $haikuSourceDir/headers/posix $tmpIncludeDir/posix cd $gccObjDir CFLAGS="-O2" CXXFLAGS="-O2" $gccSourceDir/configure --prefix=$installDir \ --target=$haikuMachine --disable-nls --disable-shared \ - --enable-languages=c,c++ \ + --enable-languages=c,c++ --enable-lto --enable-frame-pointer \ --with-headers=$tmpIncludeDir --with-libs=$tmpLibDir \ $gccConfigureArgs || exit 1 diff --git a/src/apps/cortex/addons/common/AudioBuffer.cpp b/src/apps/cortex/addons/common/AudioBuffer.cpp index 47613bb93e..f09212714b 100644 --- a/src/apps/cortex/addons/common/AudioBuffer.cpp +++ b/src/apps/cortex/addons/common/AudioBuffer.cpp @@ -223,8 +223,8 @@ uint32 AudioBuffer::copyTo( // convert and copy a sample at a time for(; remaining; remaining -= sampleSize) { convert_sample( - (void*) *((int8*)m_pData + fromOffset), - (void*) *((int8*)target.m_pData + targetOffset), + (void*) ((int8*)m_pData + fromOffset), + (void*) ((int8*)target.m_pData + targetOffset), m_format.format, target.m_format.format); diff --git a/src/system/kernel/arch/x86/ioapic.cpp b/src/system/kernel/arch/x86/ioapic.cpp index 78f6129718..6d40b1645b 100644 --- a/src/system/kernel/arch/x86/ioapic.cpp +++ b/src/system/kernel/arch/x86/ioapic.cpp @@ -529,8 +529,8 @@ acpi_configure_source_overrides(acpi_table_madt* madt) if (info->SourceIrq != info->GlobalIrq) { // we need a vector mapping install_io_interrupt_handler(info->GlobalIrq, - &ioapic_source_override_handler, (void*)info->SourceIrq, - B_NO_ENABLE_COUNTER); + &ioapic_source_override_handler, + (void*)(addr_t)info->SourceIrq, B_NO_ENABLE_COUNTER); sSourceOverrides[info->SourceIrq] = info->GlobalIrq; }