From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Wed, 5 Aug 2020 08:56:09 -0400 Subject: [PATCH] log: Allow LOG_DEBUG to always enable log output In-Reply-To: <8708d832-cdc2-9875-2ce1-848c0a8869be@gmx.de> References: <20200727022735.1435481-1-sjg@chromium.org> <20200805121819.GA24776@bill-the-cat> <8708d832-cdc2-9875-2ce1-848c0a8869be@gmx.de> Message-ID: <20200805125609.GL6965@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, Aug 05, 2020 at 02:54:05PM +0200, Heinrich Schuchardt wrote: > On 05.08.20 14:18, Tom Rini wrote: > > On Sun, Jul 26, 2020 at 08:27:35PM -0600, Simon Glass wrote: > > > >> At present if CONFIG_LOG enabled, putting LOG_DEBUG at the top of a file > >> (before log.h inclusion) causes _log() to be executed for every log() > >> call, regardless of the build- or run-time logging level. > >> > >> However there is no guarantee that the log record will actually be > >> displayed. If the current log level is lower than LOGL_DEBUG then it will > >> not be. > >> > >> Add a way to signal that the log record should always be displayed and > >> update log_passes_filters() to handle this. > >> > >> Signed-off-by: Simon Glass > > > > This exposes an underlying problem with LOG and clang I believe: > > https://gitlab.denx.de/u-boot/u-boot/-/jobs/135789 > > > > include/log.h:147:44: note: expanded from macro 'log' > if (CONFIG_IS_ENABLED(LOG) && (_LOG_DEBUG || _l <= > _LOG_MAX_LEVEL)) \ > ^ > drivers/misc/p2sb_emul.c:197:10: error: converting the enum constant to > a boolean [-Werror,-Wint-in-bool-context] > > This seems to be a Clang bug. _LOG_DEBUG is not an enum: > > #if CONFIG_IS_ENABLED(LOG) > #ifdef LOG_DEBUG > #define _LOG_DEBUG??????1 > #else > #define _LOG_DEBUG??????0 > #endif > > So there seems to be a bug in the Clang you used. > > Compiling with clang on Debian Bullseye does not show the problem: > > make HOSTCC=clang sandbox_defconfig > make HOSTCC=clang CC=clang -j8 > > clang version 9.0.1-13 > LLVM version 9.0.1 > > Which Clang version did you use? > > This is the change that added the test: > https://reviews.llvm.org/D63082 > > -Wint-in-bool-context seems to be new in Clang 10. > > All over the U-Boot code we assume that a non-zero integer is true. Do > we really want to enable -Wint-in-bool-context? I'm using the official Clang 10 stable builds. -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: