gcc-warning Questions
5
Solved
I am new to c++.
I want to ignore warning -Wunused-result which I guess popped because of -Wall flag. I did search on net and found that this is I can ignore it by declaring a pragma. I don't have ...
Pinkham asked 13/11, 2016 at 16:17
6
Solved
I'm getting the following gcc format-truncation warning:
test.c:8:33: warning: ‘/input’ directive output may be truncated writing 6 bytes into a region of size between 1 and 20 [-Wformat-truncatio...
Ninetieth asked 26/7, 2018 at 8:26
4
Solved
I have this warning pop up when I'm trying to compile the following union:
10:5: note: offset of packed bit-field 'main()::pack_it_in::<anonymous struct>::two' has changed in GCC 4.4
#pragma...
Loose asked 21/12, 2016 at 1:22
1
I compiled the following code with g++ -Wuninitialized (g++ Version 7.5.0) and I didn't get any warning:
#include <algorithm>
int main() {
int a, b;
b = std::min(a, 0);
}
As you ...
Tricot asked 19/12, 2020 at 17:41
14
Solved
For instance:
Bool NullFunc(const struct timespec *when, const char *who)
{
return TRUE;
}
In C++ I was able to put a /*...*/ comment around the parameters. But not in C of course, where it gives...
Shelf asked 30/8, 2010 at 9:14
23
Solved
I have a cross platform application and in a few of my functions not all the values passed to functions are utilised. Hence I get a warning from GCC telling me that there are unused variables.
Wha...
Utterance asked 28/9, 2009 at 13:4
1
Solved
I've been tasked with eliminating the warnings in a largish C++ project, most of which I did not write, and one of the more common warnings is emitted for things like this:
std::unique_ptr<DIR, ...
Mylonite asked 9/8, 2023 at 12:15
6
Solved
How can I suppress following warning from gcc linker:
warning: the use of 'mktemp' is dangerous, better use 'mkstemp'
I do know that it's better to use mkstemp() but for some reason I have to use...
Randellrandene asked 12/4, 2009 at 17:37
2
Solved
Why is GCC warning me this line is "misleadingly indented as if it were guarded by" an if?
The warning is:
/home/dronz/OF/apps/myApps/HexMap/src/HexMap.cpp:48:5: warning:
this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (toHexSize < 1)
^~
/home/dronz/OF/apps/myApps...
Infection asked 13/5, 2018 at 17:42
3
Solved
I have the following innocuous looking code:
void myFunc(){
struct stance {
long double interval;
QString name;
};
// [...]
}
When I build this using standard version of gcc on Ubuntu 18.04...
Ulloa asked 26/8, 2018 at 22:31
5
Solved
I am trying to compile mitk on ubuntu and I got this error :
error: this statement may fall through [-Werror=implicit-fallthrough=]
Here there is a part of code :
/** Get memory offset for...
Austerlitz asked 15/4, 2019 at 15:54
0
If I compile g++ with -Wformat on the following code, I get a warning, as expected.
int main(int argc, char * argv[])
{
printf("argc %lld\n", argc);
}
However, if compile the following ...
Spermic asked 25/2, 2023 at 14:21
1
struct details_state {
struct details_status D1;
struct details_status D2;
};
struct details {
struct details_state details_states[2];
} __attribute__((packed));
struct details *p;
voi...
Hyperthyroidism asked 22/2, 2022 at 8:17
3
Why doesn't GCC (4.6.3) give me any warning for the unreachable code in the below example?
#include <stdio.h>
int status(void)
{
static int first_time = 1;
if (first_time) {
return 1;
f...
Majesty asked 22/6, 2013 at 10:54
2
Solved
[Question inspired by a comment thread at this answer.]
As everyone knows, since C99 it's an error to call a function that hasn't been declared, preferably with a proper prototype.
But, going bey...
Smash asked 17/5, 2018 at 22:0
1
I am using gcc 4.9.2 with ccache 3.1.10. My shell environment contains GCC_COLORS=auto (from here; tried yes and always too).
As a minimal test I compile this main.c file
int main() {
int a;
retu...
Nellanellda asked 7/2, 2016 at 14:5
6
Solved
I have been getting following warning while compiling the C source code in the gcc 4.6.1.
warning: variable set but not used [-Wunused-but-set-variable]
I refered to this link Wunused but could...
Dominicadominical asked 18/8, 2011 at 22:52
1
Solved
I am trying to migrate an old C++03 codebase to C++11. But I fail to understand what gcc is warning me about in the following case:
% g++ -std=c++03 t.cxx
% g++ -std=c++11 t.cxx
t.cxx: In function ...
Allurement asked 22/6, 2022 at 8:44
2
Solved
Question on returning std::tie from a function. If I understand correctly, then std::tie only contains references. So, returning a std::tie which points to function-local variables is a very bad id...
Macfarlane asked 17/6, 2022 at 9:23
3
Solved
I am getting warning:
miniunz.c:342:25: Passing 'const char *' to parameter of type 'char *'
discards qualifiers
in miniunz.c file of the Zip Archive library. Specifically:
const char* write...
Proselytize asked 29/1, 2014 at 5:33
1
Solved
I have upgraded my whole arch linux system today (12th May, 2022). gcc was also upgraded from v11.2 to v12.1. I tried compiling some of my programs with g++ (part of gcc compiler collection) by the...
Pretended asked 12/5, 2022 at 16:15
1
I'm adding warnings (and treating them as errors) to my C++ project which uses CMake for builds. Initially I used target_compile_options. But as I've added more warnings I've found that they're bei...
Tolyl asked 29/4, 2022 at 5:29
1
Solved
If I use the compiler option -Wfloat-equal with GCC or Clang, equality comparisons of float/double values cause a warning. However, when comparing containers (like std::vector or std::tuple) of flo...
Timberland asked 29/4, 2022 at 7:44
8
Solved
I would like to enable—literally—all of the warnings that GCC has. (You'd think it would be easy...)
You'd think -Wall might do the trick, but nope! You still need -Wextra.
You'd think -Wextra mi...
Natascha asked 30/7, 2012 at 2:39
2
Solved
So I have some code here that compiles with gcc, clang, and msvc:
#include <cstdio>
#include <type_traits>
struct c_class;
template <class T> struct holder { friend auto adl_loo...
Liv asked 23/2, 2022 at 1:47
1 Next >
© 2022 - 2025 — McMap. All rights reserved.