Questions tagged [compiler-warnings]

Messages emitted by a compiler which indicate potential problems in code or configuration.

Compiler warnings typically flag patterns in code that could potentially cause problems, but for lack of context the compiler cannot declare absolutely that the code is flawed.

2652 questions
1
vote
0 answers

Play console warning with native code, React Native App

I had a warning form Google Play Console, that my aab contains native code and I need to upload symbol files. I have done all the steps from https://support.google.com/googleplay/android-developer/answer/9848633?hl=en, and if i enter the ndkPath =…
1
vote
3 answers

What does "C6011 dereferencing null pointer" mean in my program?

I have a simple exercise in C (see code below). The program takes a vector with three components and double each component. The IDE showed me this warning (green squiggle): C6011 dereferencing null pointer v. in this line: v[0] = 12;. I think it's a…
1
vote
0 answers

MSVC how to enable all warnings in a single file

I am coding with Visual Studio and Unreal Engine. Due to the last reason the compilation of the project is driven by the Unreal Build Tool, and it's not possible to me to set the warning level of the project for example. I have found a solution to…
giuseppe
  • 184
  • 1
  • 12
1
vote
1 answer

Can gcc warn when constructor-style casts behave like old-style casts?

Old-style casts should be avoided for a number of reasons. And gcc offers the handy -Wold-style-casts to detect them. This works fine, but for non-class types, constructor-style casts behave exactly like old-style casts, minus the…
bitmask
  • 32,434
  • 14
  • 99
  • 159
1
vote
1 answer

Is there any way I can fix or avoid errors when installing RTL8812AU driver?

I'm trying to install the Realtek-rtl8812au driver (Archer T4U V3) and I can't do anything because I get stuck at compile. It doesn't matter what package I clone from git or what driver package I am using, I can't compile properly. I tried different…
ASCII404
  • 25
  • 6
1
vote
1 answer

no return statement in function returning non-void while using C++

I am trying to understand the C++(GCC compiler) expectation of return statement in a non-void function. For example, running this piece of code is working fine: int foo() { throw "blah"; } While, on the other hand, if we try to use/call some…
DonBaka
  • 325
  • 2
  • 14
1
vote
1 answer

GCC 11 order of arguments triggers false positive Wstringop-overflow, is this bug?

Minimal code: #include #include // gcc test.c // gcc 11.2.1 20210816 [revision 056e324ce46a7924b5cf10f61010cf9dd2ca10e9] // bug // test.c:41:5: Warning: «test_bug» accessing 8 bytes in a region of size 4…
Danil S
  • 67
  • 7
1
vote
2 answers

Xcode development, can I place #pragma unused(x) via some #define rule

while developing in Xcode it is common to switch between Debug and Release mode and using some parts of code in Debug mode only while not using some in Release mode. I often throw out NSLog code by some #define rule that lets the Pre-compiler parse…
Ol Sen
  • 3,163
  • 2
  • 21
  • 30
1
vote
1 answer

Strawberry Perl warning Subroutine Config::STORE redefined from perl libs?

I'm maintaining a few Perl scripts and recently I noticed that many of them output Subroutine ... redefined warnings from some "system" stuff, that is not from any code we've written. A stripped down example I could come up now is: #!perl -W use…
Martin Ba
  • 37,187
  • 33
  • 183
  • 337
1
vote
3 answers

How to detect the assignment instead of the equality operator inside the IF condition in Visual Studio?

Today I was researching a bug which, in my opinion, was caused by an unnecessary mistake that a compiler could detect. var isFoo = true; var bar = 1; if (isFoo = false && bar > 0) // Compiler is not warning about assignment instead of equality { //…
Muflix
  • 6,192
  • 17
  • 77
  • 153
1
vote
1 answer

Shouldn't I be warned about undefined behavior with -INT_MIN?

Consider the following C program: #include int main() { int x = INT_MIN; int y = -x; return y; } This program has undefined behavior, as the negation of INT_MIN is not representable; or, to be a language lawyer - since the C…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
1
vote
1 answer

Fix warning "unused conversion function" in derived class

Originally the base class B was derived from class A. But as C derives from both A and B I got into a nasty diamond shaped inheritance and thus removed the inheritance in B opting for a conversion function to A. Now I'm getting warnings for classes…
1
vote
0 answers

Warn if invalid value for an enum is passed?

If I have a function that takes an enum parameter, and I pass a literal that does not represent a valid enum member, can I get the compiler to emit a warning (gcc, clang, msvc?) Example code: typedef enum { GPIO_0, GPIO_1, GPIO_2, …
jdm
  • 9,470
  • 12
  • 58
  • 110
1
vote
1 answer

Is it possible to emit a warning on implicit float to bool conversion in MSVC?

In this example I want MSVC to emit a warning: auto func(float f) -> int { if(f) { return 654321;} // true if f != 0.0F else { return 123456; } } So that I'm forced to write: auto func(float f) -> int { if(f != 0) { return 654321;} else {…
Viktor Sehr
  • 12,825
  • 5
  • 58
  • 90
1
vote
0 answers

How to make a warning message being shown while coding on visual studio with C#

You can view this post first to easier to understand my problem. When I use UseMvc() method without using Endpoint Routing, the visual studio show a warning message while I'm coding. I know how to solve the warning. But I want to know how we could…
Alex
  • 43
  • 6