🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #3685

Bug#1153357: cppcheck: syntaxError: -!!x

#3685
From: Alejandro Colomar
Date: Sat, 07 Nov 2026 18:00
67 lines
3204 bytes
Package: cppcheck
Version: 2.22.0-1
Severity: normal
Tags: upstream
X-Debbugs-Cc: alx@kernel.org

Dear Maintainer,

cppcheck(1) seems to report a syntaxError in the following line of code:

	return -!!status;

which is perfectly valid C (and AFAIK, also C++).

Here's an example of a function in which that happens:

	inline int
	a2sll_nc(long long *restrict n, char *restrict s,
	    char **restrict endp, int base,
	    long long min, long long max)
	{
		int  status;

		*n = a2i_strtoi(s, endp, base, min, max, &status);
		if (status != 0)
			errno = status;

		return -!!status;
	}

This seems to be a regression, since I hadn't seen that error before.
However, I don't know when it started appearing, since it's been more
than a year since I last analyzed that code.


Have a lovely night!
Alex


-- System Information:
Debian Release: forky/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 7.2.12+deb14-amd64 (SMP w/16 CPU threads; PREEMPT)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages cppcheck depends on:
ii  libc6             2.43-7
ii  libgcc-s1         16.2.0-3
ii  libstdc++6        16.2.0-3
ii  libtinyxml2-11    11.0.0+dfsg-1+b3
ii  python3           3.14.8-1
ii  python3-pygments  2.20.0+dfsg-2

cppcheck recommends no packages.

Versions of packages cppcheck suggests:
ii  clang         1:21.1.8-74
ii  clang-tidy    1:21.1.8-74
pn  cppcheck-gui  <none>

-- no debconf information
Technical Details
Message-ID: <NWSRP-aqZz-5@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
From: Alejandro Colomar <alx@kernel.org>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1153357: cppcheck: syntaxError: -!!x
Date: Sat, 07 Nov 2026 19:00:01 +0100
Message-ID: <NWSRP-aqZz-5@gated-at.bofh.it>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Sat Nov  7 17:55:09 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.65
Reply-To: Alejandro Colomar <alx@kernel.org>, 1153357@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: alx@kernel.org, reichel@debian.org
X-Debian-Pr-Message: report 1153357
X-Debian-Pr-Package: cppcheck
X-Debian-Pr-Keywords: upstream
X-Debian-Pr-Source: cppcheck
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Mailer: reportbug 13.2.0+nmu1
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2001310
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 67
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Sat, 07 Nov 2026 18:53:33 +0100
X-Original-Message-ID: <179407401349.246109.7529008404217467415.reportbug@debian>