Article View: gnu.g++.bug
Article #1possible -Wunused-variable bug
From: Tibor Áser Veres
Date: Sat, 04 Jun 2022 15:57
Date: Sat, 04 Jun 2022 15:57
67 lines
4326 bytes
4326 bytes
Hi!
I'm new here, and in the process of learning c++. Not sure where should I report bugs... for g++ compiler.
When I enabled -Wunused I'm getting these warnings:
In file included from /media/LocalDrives/SSD/Programs/HydraFort/Source/../HexaLib-GUI/HexaLib-GUI.h:23,
from /media/LocalDrives/SSD/Programs/HydraFort/Source/Main.cpp:2:
/media/LocalDrives/SSD/Programs/HydraFort/Source/../HexaLib-GUI/HLGlobals.h:17:33: warning: ‘HexaLib::AMask’ defined but not used [-Wunused-variable]
17 | static uint32_t AMask = 0xff000000;
| ^~~~~
/media/LocalDrives/SSD/Programs/HydraFort/Source/../HexaLib-GUI/HLGlobals.h:16:33: warning: ‘HexaLib::BMask’ defined but not used [-Wunused-variable]
16 | static uint32_t BMask = 0x00ff0000;
| ^~~~~
/media/LocalDrives/SSD/Programs/HydraFort/Source/../HexaLib-GUI/HLGlobals.h:15:33: warning: ‘HexaLib::GMask’ defined but not used [-Wunused-variable]
15 | static uint32_t GMask = 0x0000ff00;
| ^~~~~
/media/LocalDrives/SSD/Programs/HydraFort/Source/../HexaLib-GUI/HLGlobals.h:14:33: warning: ‘HexaLib::RMask’ defined but not used [-Wunused-variable]
14 | static uint32_t RMask = 0x000000ff;
| ^~~~~
In file included from /media/LocalDrives/SSD/Programs/HydraFort/HexaLib/HexaLib.h:23,
from /media/LocalDrives/SSD/Programs/HydraFort/Source/../HexaLib-GUI/HexaLib-GUI.h:22,
from /media/LocalDrives/SSD/Programs/HydraFort/Source/Main.cpp:2:
/media/LocalDrives/SSD/Programs/HydraFort/HexaLib/HexaLog.h:28:21: warning: ‘HexaLib::AppendFile’ defined but not used [-Wunused-variable]
28 | static bool AppendFile = false;
| ^~~~~~~~~~
/media/LocalDrives/SSD/Programs/HydraFort/HexaLib/HexaLog.h:26:25: warning: ‘HexaLib::TraceFocus’ defined but not used [-Wunused-variable]
26 | static uint16_t TraceFocus = 0; // 0 = Silent, Trace>0 = focus that trace, 65535 = Default trace(if no Trace specified...)
| ^~~~~~~~~~
/media/LocalDrives/SSD/Programs/HydraFort/HexaLib/HexaLog.h:25:21: warning: ‘HexaLib::LogLevel’ defined but not used [-Wunused-variable]
25 | static char LogLevel = 'I'; // 'S' = Silent, 'E' = Errors, 'W' Errors and Warnings, 'I' = Errors, Warnings, and Info 'D' everything including debug messages.
| ^~~~~~~~
I checked all of those variables are used, and my program works just fine. In fact if I remove any of them I get errors instead...
The common thing about them is that they are all static global variables, within the HexaLib namespace.
Here's the g++ version:
g++ (Ubuntu 11.2.0-19ubuntu1) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Technical Details
Message-ID:
<d5c837e2-c82a-4da0-94dc-3a5ea3b7ac5en@googlegroups.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!archive!apf1.newsdeef.eu!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <d5c837e2-c82a-4da0-94dc-3a5ea3b7ac5en@googlegroups.com> Subject: possible -Wunused-variable bug Date: Sat, 04 Jun 2022 15:57:09 +0000 From: Tibor Áser Veres <v.tibor.a@gmail.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!archive!apf1.newsdeef.eu!not-for-mail X-Received-Bytes: 4436 User-Agent: G2/1.0 Injection-Date: Sat, 04 Jun 2022 15:57:09 +0000 Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" Newsgroups: gnu.g++.bug Nntp-Posting-Host: 94.52.87.195 X-Received: by 2002:a05:620a:1510:b0:6a3:9b95:196 with SMTP id i16-20020a05620a151000b006a39b950196mr10905763qkk.152.1654358229466; Sat, 04 Jun 2022 08:57:09 -0700 (PDT) X-Received: by 2002:a05:622a:1452:b0:304:5453:fa43 with SMTP id v18-20020a05622a145200b003045453fa43mr12397060qtx.297.1654358229289; Sat, 04 Jun 2022 08:57:09 -0700 (PDT)