Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > gnu.g++.bug > #4

possible -Wunused-variable bug

Newsgroups gnu.g++.bug
Date 2022-06-04 08:57 -0700
Message-ID <d5c837e2-c82a-4da0-94dc-3a5ea3b7ac5en@googlegroups.com> (permalink)
Subject possible -Wunused-variable bug
From Tibor Áser Veres <v.tibor.a@gmail.com>

Show all headers | View raw


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.

Back to gnu.g++.bug | Previous | Find similar


Thread

possible -Wunused-variable bug Tibor Áser Veres <v.tibor.a@gmail.com> - 2022-06-04 08:57 -0700

csiph-web