Questions tagged [compiler-options]

Compiler-options are parameters that are being passed to the compiler and that affect the compilation process or its resulting product.

Modern compilers have a large set of options that can be used to somehow change the way the code is compiled. Usually those options are passed as command-line flags.

Example for Java:

javac -target 1.5 -bootclasspath jdk1.5.0\lib\rt.jar \ -extdirs "" OldCode.java

More information about particular options can be found on compiler vendor's websites, to name a few:

244 questions
5
votes
2 answers

VScode: How to autocomple json/scss/image file paths from shortcut paths specified in jsconfig shortcuts

When doing imports, intellisense will suggest autocompletion names when I am trying to import a React .jsx component. Nothing will be suggested when I am trying to import json or scss files though. I have a set of aliases that I set up in my…
Sam
  • 1,765
  • 11
  • 82
  • 176
5
votes
0 answers

Clang targets: thread-local storage is not supported

There are several questions about compiler options. Now I use the following: -target i386-windows-gnu -mno-sse -c -O3 -target x86_64-windows-gnu -mcx16 -c -O3 -target i386-linux-gnu -mno-sse -c -O3 -target x86_64-linux-gnu -mcx16 -c -O3 -target…
5
votes
1 answer

What does -march=native boil down to?

Currently we compile and run code on same hardware, so -march=native flag is used. We are going to keep running on this hardware but compile on different architecture. So I need to replace native with whatever it is equivalent to on current…
user2052436
  • 4,321
  • 1
  • 25
  • 46
5
votes
1 answer

Restrict assignment in if statements in Typescript

Recently I caught a nasty bug caused by assignment in If statement. I consider if-assignment as a bad pattern for me and I want to turn it off completely to get the compiler varnings instead of actual bugs. How can I do this in Typescript?
gleb.kudr
  • 1,518
  • 12
  • 16
5
votes
1 answer

Detect (meaningless) assignment to temporary object

Is there any compiler option that allows you to get a warning when you try to assign to temporary object? Example: struct S { S op() { return S(); } }; int main() { S s; s.op() = s; // assign to temporary. Wants to warn here. } I know…
5
votes
2 answers

How to set compiler-specific flags with autotools

We use autotools as our build infrastructure, and we use clang and gcc as compilers. Recently we hit a gcc warning that needed --param max-vartrack-size=100000000 to silence (without completey disabling gcc's vartracking). Clang doesn't accept that…
Irfy
  • 9,323
  • 1
  • 45
  • 67
5
votes
0 answers

Accessing method parameter names in scala using java reflection

I need to get a method's parameter name in one of my scala file. I know, by using -parameter compiler option, I can make this work in Java. However, I am not able to do this in scala,as I could not find -parameter option in scalac. How can I…
Yadu Krishnan
  • 3,492
  • 5
  • 41
  • 80
5
votes
3 answers

Telling gcc diagnostics apart

I have a problem interpreting gcc (4.8.2) warnings & errors. More precisely, it's difficult to tell where one problem ends and another one starts. I have console-only access to the build machine, so using an IDE is not an option. I really need to be…
5
votes
1 answer

How can I set options in SConstruct for C compiler depending on compiler type?

I need to set additional options for C compiler, e.g. add flag to turn all warnings ON, depending on the type of the compiler. E.g. for MSVC I should use env.Append(CPPFLAGS = "/Wall") but for mingw (gcc) I need to use: env.Append(CCFLAGS =…
bialix
  • 20,053
  • 8
  • 46
  • 63
5
votes
2 answers

Compiler option for "Use Debug DCU's"?

In a component I am writing, I want to include automatic detection of registered image formats, but it is a solution that only works if the Use Debug DCU's compiler option is disabled. What I really would like to know is an alternative for this…
NGLN
  • 43,011
  • 8
  • 105
  • 200
5
votes
2 answers

Any option in C++ to set default variable type to int

Is there any option to omit variable type or to set variable type to int in c++ code that to be compiled with g++ compiler in linux. const bufLen = 2000; Compilation went fine in solaris (as I am doing porting from solaris to linux). One more…
Makesh
  • 1,236
  • 1
  • 11
  • 25
4
votes
2 answers

What happens if both EHsc and EHa are specified

I am handling a legacy code. To fix some bug, I have to give EHa to some of the files. I tested giving both EHsc and EHa to the whole project when building. This solves my problem but gives warnings saying that compiler is overriding EHs with…
Niroshan
  • 2,064
  • 6
  • 35
  • 60
4
votes
1 answer

What's optimal march & mtune options for gcc for "Pentium4 and above" processors

My C++ application (compiled using g++) needs to work on Pentium-4 (32-bit) and above. However, it's typically used with Core2Duo or better processors. I'm currently using: -march=pentium4 -mtune=pentium4. But some reading has prompted me to think…
Syam
  • 163
  • 1
  • 8
4
votes
1 answer

Does Rust/Cargo link statically to MSVCRT?

In Windows, when compiling C++, I can specify /MT compiler option to use a static version of the runtime library, ie. to not link dinamically to MSVCRT. How does Rust/Cargo behave in this regard, since there is no such option? Does it link static or…
rodrigocfd
  • 6,450
  • 6
  • 34
  • 68
4
votes
1 answer

How to workaround value-discard or unused warnnings

While it is recommended to turn on compiler flags like -Wvalue-discard or -Wunused:implicits either explicitly or implicitly throught the use of sbt-tpolecat. Sometimes you need to workarround those, but in a way that makes it explicit; since we…