Questions tagged [compiler-flags]

Parameters that may be passed to a compiler affecting how compilation is carried out. These can have a variety of effects on the paths searched for external dependencies, optimization level, how source code is interpreted, code checks that are performed and preprocessor directives.

Parameters that may be passed to a compiler affecting how compilation is carried out. These can have a variety of effects on the paths searched for external dependencies, optimization level, how source code is interpreted, code checks that are performed and preprocessor directives.

479 questions
5
votes
2 answers

Suppress anonymous structs warning with Clang - "-fms-extensions" doesn't work

I have an Xcode project that I compile with Clang using some 3rd party library with Visual Studio C code. In the 3rd party library anonymous structs are used in header files (I can't really change that). Thus I get this warning: "myfile.h:47:17:…
5
votes
1 answer

Influencing function cloning/duplication/constant propagation in gcc

When running gcc with optimizations-on, it clones (duplicates) C functions when it considers that the function is in a hot path or there's constants propagating to the function arguments. More specifically, this seems to be controlled by the…
Giovanni Funchal
  • 8,934
  • 13
  • 61
  • 110
5
votes
1 answer

How to pass values during compilation with g++ using -DN flag

I've heard that you can set values in your c++ program during compilation using g++'s -DN flag. Can anybody explain how? Thank you
Soroosh Khoram
  • 417
  • 1
  • 7
  • 11
5
votes
1 answer

Why do common section variables only show up in object file not the executable?

I'm trying to understand more about the "common" section of an executable and I noticed that when doing an objdump on compiled code, I can see variables placed in the common code only on object files (*.o) not on executables. Why is…
Mike
  • 47,263
  • 29
  • 113
  • 177
5
votes
3 answers

How to set CUDA compiler flags in Visual Studio 2010?

After persistently getting error : identifier "atomicAdd" is undefined, I've found the solution to be to compile with -arch sm_20 flag. But how to pass this compiler flag in VS 2010? I have tried like so under Project > Properties: But this…
mchen
  • 9,808
  • 17
  • 72
  • 125
5
votes
2 answers

How to let the HotSpot VM be in debug mode?

The reason that I need the HotSpot VM be in debug mode, is that I want some JVM options, like -XX:+PrintCFGFile, be supported. My current JVM version is like java version "1.6.0_24" OpenJDK Runtime Environment (IcedTea6 1.11.1)…
JackWM
  • 10,085
  • 22
  • 65
  • 92
4
votes
1 answer

MSVS C++, how to compile already-preprocessed file with *.i extension?

Related question here: How can I run the MSVC preprocessor and compiler in two separate steps? I explicitly pre-process a MyFile.cpp (not compile) to a MyFile.i. I want to later "compile" that file (explicitly skipping preprocessing would be nice,…
4
votes
1 answer

How can I use the incubating Vector API from Kotlin in a Gradle build?

I want to use the new Vector API from a Kotlin project using a Gradle build. I tried this: tasks.withType { kotlinOptions.jvmTarget = "17" kotlinOptions.freeCompilerArgs = listOf("--add-modules",…
Hakanai
  • 12,010
  • 10
  • 62
  • 132
4
votes
1 answer

I tried: valgrind, _GLIBCXX_DEBUG, -fno-strict-aliasing; how do I debug this error?

I have a really strange error that I've spend several days trying to figure out, and so now I want to see if anybody has any comments to help me understand what's happening. Some background. I'm working on a software project which involves adding…
amos
  • 5,092
  • 4
  • 34
  • 43
4
votes
1 answer

cmake how to append compiler flags to the end in C++

I want set compiler C++ standard to gnu++17 but I cant do that with CMAKE_CXX_STANDARD as it gives me gnu++17 is invalid value.Thus I put it in CMAKE_CXX_FLAGS . But when I compile cmake appends std=gnu++11 to the end of command like…
user9392253
4
votes
6 answers

strange results of simple floating point operations - bad FPU internal state?

I have a software project in which I sometimes get strange results from small, simple floating point operations. I assume there is something I have missed, and would like some tips about how to debug the following problems: (the compiler used is MS…
4
votes
1 answer

GCC variables alignment issues

I'm using GCC compiler for Microblaze processor. Recently I have encountered a problem with variable alignment. I've noticed that sometimes the compiler allocates static variable to an unaligned address (the address is not divisible by 4), so if I…
Moshon
  • 71
  • 5
4
votes
1 answer

How to properly use scalac -Xlint

scalax -Xlint help provides the following info: $ scalac -Xlint:help Enable or disable specific warnings adapted-args Warn if an argument list is modified to match the receiver. nullary-unit Warn when nullary methods…
pedrorijo91
  • 7,635
  • 9
  • 44
  • 82
4
votes
0 answers

g++ warnings for variable shadowing in lambda expressions

Why does the following code generate a warning when it is compiled with g++ -Wshadow -std=c++14? template void f(Function g) { int x; g(0); } int main() { auto g = [](auto x) {}; f(g); return 0; } Compilation (assume…
aksjis
  • 41
  • 1
4
votes
2 answers

How to use a variable from a Makefile in #ifdef in C++ file

Makefile ifeq ($(wifiSim),1) WIFISIM :=1 endif all: test.cpp test.cpp : test.o ./a.out test.o : c++ test.cpp test.cpp #include using namespace std; int main() { #ifdef WIFISIM cout <<…
a2n3k7it
  • 65
  • 1
  • 6