Questions tagged [gcc-warning]

GCC is the GNU Compiler Collection, encompassing the gcc C compiler and the g++ C++ compiler, among others. It has powerful warning facilities that can reveal coding errors in C and C++ code.

GCC is the GNU Compiler Collection, a collection of language compilers that use the same underlying infrastructure. The most prominent are gcc, for C, and g++, for C++. All GCC compilers have similar warning facilities, starting with -Wall and including many other -W flags. These warnings can be extremely helpful in diagnosing problems with code and improving coding style and portability.

824 questions
-1
votes
1 answer

GCC warning 'comparison is always true' when comparing the return of ntohs with a integer

I'm having a hard time to understand why I'm getting this compilation warning while using GCC 4.8.4 on Linux: warning: comparison is always true due to limited range of data type [-Wtype-limits] when comparing values like these: uint16_t…
Henrique Gouveia
  • 131
  • 1
  • 10
-1
votes
1 answer

How to get compiler warnings JUCE - Ubuntu

I was recently dealing with an error that should have easily been realized with a simple compiler warning. Does anyone know how to get compiler warnings to show up when compiling JUCE projects with make on Ubuntu? I attempted: make -Wall from the…
brenthompson2
  • 391
  • 3
  • 9
-1
votes
1 answer

Is GCC correct to warn of format string mismatch with a scoped enum?

When using a scoped enum in a varargs context, it is defined to be passed as its underlying type, as answered in "Can I use enum class values as arguments to varargs functions?" As I understand it, this is the only circumstance in which a scoped…
Toby Speight
  • 27,591
  • 48
  • 66
  • 103
-1
votes
1 answer

How do I suppress warning : "struct xxyy declared inside parameter list"?

I want to use one of the options provided in the link below to suppress the warning: warning : struct xxyy declared inside parameter list https://gcc.gnu.org/onlinedocs/gcc-4.4.5/gcc/Warning-Options.html My requisite is to suppress this warning,…
Anonymous
  • 1
  • 1
-1
votes
1 answer

cc1plus: some warnings being treated as errors

In system: Fedora 21 Ruby 2.1.7 GCC 4.9.2 I follow the instructions for installing simstring but afer $ruby extconf.rb when trying to make and make install, I got an error: cc1plus: some warnings being treated as errors Makefile:217: recipe for…
Ali mahdi
  • 1
  • 1
  • 1
-1
votes
1 answer

gcc 5.3 -Wunused-parameter in generic lambda

After GCC update to gcc-5.3 I am getting -Wunused-parameter warning in a code sample that didn't had issues previously. g++ prog.cc -std=c++14 "-Wunused-parameter" "-Werror" int main() { [](auto... xs) { return sizeof...(xs);…
Karol Wozniak
  • 283
  • 1
  • 7
-1
votes
1 answer

converting char array to a char constant (c)

so im trying to figure out how to change an array to a constant but i keep getting a this error warning: incompatible pointer types passing 'char *[3]' to parameter of type 'char *' [-Wincompatible-pointer-types] strcpy(input, inputcon); …
-1
votes
2 answers

Disable gcc error parameter '' includes pointer to array of unknown bound

I have the following code line: typedef P2FUNC(Std_ReturnType, APP1, GetData) (P2VAR(max_data, AUTOMATIC, APP2) whereby P2FUNC and P2VAR is a compiler Macro: #define P2FUNC(rettype, ptrclass, fctname) rettype (*fctname) #define P2VAR(ptrtype,…
JohnDoe
  • 825
  • 1
  • 13
  • 31
-1
votes
2 answers

C++ Macro causing :"warning: unused variable "LOG__METHOD__" "

I have a macro in my C++ code, macro has an unused variable. I am getting warning for that variable the macro is to print the class and method name #define LOG_ENTER(func_name, message) \ …
rkk
  • 51
  • 1
  • 4
-1
votes
1 answer

random header when added in c++ programme not working

While compiling the above code this is the error which i am getting. #include #include int main() { std::default_random_engine generator; std::uniform_int_distribution distribution(1,6); int dice_roll =…
Ganesh Delli
  • 61
  • 1
  • 10
-2
votes
1 answer

memcmp on a zero length array got array-bounds error

There is a main.c file, whose content is: #include "memory.h" #include "stdint.h" #define MOLECULE_API_DECORATOR MOLECULE_API_DECORATOR const uint8_t MolDefault_ByteOpt[0] = {}; int main(int argc, char *argv[]) { uint32_t size =…
Eval EXEC
  • 1
  • 1
-2
votes
1 answer

Warning: '%s' directive writing up to 2047 bytes into a region of size 56 [-Wformat-overflow=]

I have a overflow warning but i dont understand what is wrong.I have gcc10. This is entire code block. Also i'm try char name 2048 or 1024 or 512 or 256 also 64 - 128 getting same warn every time, i'm search almost every stackflow post but nothing…
Hardy35
  • 1
  • 1
  • 4
-2
votes
1 answer

What are the hazards of comparing expression of different signedness in C and C++?

I'm use to use gcc and g++ with -Wall and -Wextra flags since I don't want my code to contain any warnings. Sometimes I understand the reason why I should solve the warnings that comes up after compiling but some other times I don't. One example is…
j0s3
  • 13
  • 1
  • 2
-2
votes
1 answer

Newer version of GCC throws invalid conversion error

class FixedDataBlock: public DataBlockHeaderCommon { // Construction public: FixedDataBlock(void* pool, SizeT const entrySize, SizeT const alignment) : base_t(eBlkFixData, pool) { …
mmm
  • 85
  • 1
  • 8
-2
votes
3 answers

Error on char array declaration in GCC 3.3.4

int main () { char b[100]; for (int i = 1; i <= 10; i++ ) scanf ("%c%*c", b[i]); } but am getting the error 'Format arguemnt is not a pointer' How can i declare an array to get all values form the user? EDIT : #include…
coderex
  • 27,225
  • 45
  • 116
  • 170
1 2 3
54
55