From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 330911381FA for ; Sun, 30 Dec 2012 14:21:26 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 15F9AE07B2; Sun, 30 Dec 2012 14:21:19 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7FEE9E07B2 for ; Sun, 30 Dec 2012 14:21:18 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 4707033C394 for ; Sun, 30 Dec 2012 14:21:17 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id DF7A4E543D for ; Sun, 30 Dec 2012 14:21:14 +0000 (UTC) From: "Julian Ospald" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Julian Ospald" Message-ID: <1356877263.dab546b74d223852bf2d6bec3ad9918d353c9859.hasufell@gentoo> Subject: [gentoo-commits] proj/devmanual:master commit in: ebuild-writing/common-mistakes/ X-VCS-Repository: proj/devmanual X-VCS-Files: ebuild-writing/common-mistakes/text.xml X-VCS-Directories: ebuild-writing/common-mistakes/ X-VCS-Committer: hasufell X-VCS-Committer-Name: Julian Ospald X-VCS-Revision: dab546b74d223852bf2d6bec3ad9918d353c9859 X-VCS-Branch: master Date: Sun, 30 Dec 2012 14:21:14 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: cff30fc8-effc-4125-8eb9-60b8e655162d X-Archives-Hash: 3a9986bf3e87b8f054e77f398da2deae commit: dab546b74d223852bf2d6bec3ad9918d353c9859 Author: hasufell googlemail com> AuthorDate: Sun Dec 30 14:21:03 2012 +0000 Commit: Julian Ospald googlemail com> CommitDate: Sun Dec 30 14:21:03 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/devmanual.git;a=commit;h=dab546b7 document handling of -Werror wrt #415979 --- ebuild-writing/common-mistakes/text.xml | 50 +++++++++++++++++++++++++++++++ 1 files changed, 50 insertions(+), 0 deletions(-) diff --git a/ebuild-writing/common-mistakes/text.xml b/ebuild-writing/common-mistakes/text.xml index b486a7e..549cb00 100644 --- a/ebuild-writing/common-mistakes/text.xml +++ b/ebuild-writing/common-mistakes/text.xml @@ -94,6 +94,56 @@ preferred. +-Werror compiler flag not removed + +"-Werror" is a flag which turns all warnings into errors and thus will abort compiling if any warning is encountered. + +

Rationale

+This flag is not recommended for releases and should always be disabled when encountered in build-logs, because there are numerous cases where this breaks without purpose, e.g.: +

    +
  • + new warnings on version bumps of GCC/GLIBC the developer was not aware of at the point of coding +
  • +
  • + some autoconf checks will fail badly +
  • +
  • + libraries adding deprecated API warnings although that API is still working/supported +
  • +
  • + on less known architectures we may get different/more warnings than on common ones +
  • +
  • + random breakage depending on what distro/architecture/library version/kernel/userland the developer was testing "-Werror" on +
  • +
+Turning off "-Werror" we will still see the warnings, but there is no reason that they cause compile failure. Also note that portage already emits QA notices about gcc warnings that can cause runtime breakage. +

+ +

How to fix

+To fix the affected build system you should try the following methods: +

    +
  • + remove the compiler flag from the build system, e.g. Makefile.am or configure.ac or even provide a switch (for autotools based build systems that could be "--disable-werror", which is good for sending a patch upstream) +
  • +
  • + use append-flags -Wno-error (needs flag-o-matic.eclass); for this to work the environment flags have to be respected and placed after build system flags; this method is not preferred as it will disable all "-Werror=specific-warning" flags as well, see next section +
  • +
+Always check that it's really gone in the build log. +

+ +

Specific -Werror=... flags

+GCC can turn any specific warning into an error. A specific -Werror flag would be "-Werror=implicit-function-declaration" for example and will only affect warnings about implicit function declarations. It's mostly safe to leave these untouched, cause they are pinned to this issue and should not cause random build time breakage. Also, we can expect that upstream did this on purpose to avoid known runtime errors and not just for testing their builds. However you should check the specified warnings yourself or ask other developers if unsure. +

+ +

Exceptions

+Removing "-Werror" from configure.ac can cause breakage in very rare cases where the configure phase relies on the exit code. See app-emulation/open-vm-tools bug. But even then we remove it from the resulting Makefile. +

+ +
+ + Missing/Invalid/Broken Header