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
20
votes
1 answer

GCC with -Werror and -Wno-error=unused does not work as expected

I always compile with -Wall -Wextra -Werror. However, many times as I do quick compile tests I need to ignore the -Wunused suite of errors. For various reasons, I want to see them as warnings and not errors while leaving all other warnings as…
bolov
  • 72,283
  • 15
  • 145
  • 224
20
votes
2 answers

How to disable narrowing conversion warnings?

I use -Wall and updating to new gcc I have got a lot of warning: narrowing conversion. I want to disable them, but leave all other warnings untouched (ideally). I can find nothing about narrowing in…
klm123
  • 12,105
  • 14
  • 57
  • 95
20
votes
1 answer

How do I increase the stack size when compiling with Clang on OS X?

Can I specify the stack size with clang++? I can't find any compiler options that would allow me to do so. I'm using OS X. Note: This question specifically refers to Clang, not the GCC compiler.
Rob Lachlan
  • 14,289
  • 5
  • 49
  • 99
20
votes
2 answers

What is the difference between "Create Precompiled Header" (/Yc) and "Use Precompiled Header" (/Yu) in Visual Studio?

I read the documentation in MSDN, but in the end I didn't get a clear idea what is the practical difference between them, exactly. Both seem to require stdafx.h to be added at the top of every *.cpp file. I'm using VS2008. Can anyone help clear…
19
votes
3 answers

Setting Default NetBeans Options (-std=c99, -Wall) for C programs

I have NetBeans 6.9 installed and working fine on Ubuntu Linux 11.10. My goal is to set compiler options like -Wall and -std=c99 to be used by default. Currently, I have to right click on my project -> Properties -> C Compiler -> Warning Level to…
dfarrell07
  • 2,872
  • 2
  • 21
  • 26
19
votes
3 answers

Why doesn't GCC show vectorization information?

I'm using Codeblocks for a C program on Windows 7. The program is using the OMP library. GCC version is 4.9.2. Mingw x86_64-w64-mingw32-gcc-4.9.2.exe. Flags used are: -fopenmp -O3 -mfpmath=sse -funroll-loops -ftree-loop-distribution -ftree-vectorize…
Franktrt
  • 373
  • 1
  • 8
  • 18
19
votes
1 answer

How can I set the language_in option for the Closure compiler?

I need to set the language_in option on the Closure compiler to prevent the IE8 parse error: ERROR - Parse error. IE8 (and below) will parse trailing commas in array and object literals incorrectly. If you are targeting newer versions of JS, set…
Elisabeth
  • 2,972
  • 6
  • 35
  • 39
16
votes
1 answer

Why is /Gm the default option in debug configuration as opposed to /MP?

After I disabled /Gm and enabled /MP, the build time on VS2010 is reduced significantly. I am confused as to why /Gm is the default. I think /MP is better. (If /Gm is enabled, /MP is not activated because of incompatibility. Activated /Gm takes more…
16
votes
1 answer

Can I use Java annotations to define compile time checks?

For example, I wanted to create the annotation @Out to target parameters. Then I would somehow use the compiler to check if the parameter value is set before the function returns. Is this possible? Also was thinking about a @Immutable annotation…
FinnTheHuman
  • 1,115
  • 13
  • 29
14
votes
2 answers

What is the benefit of using '--strictFunctionTypes' in Typescript?

As I understand it, --strictFunctionTypes compiler option in Typescript prevents a very common use case of polymorphism from working: type Handler = (request: Request) => Response const myHandler: Handler = (request: Request & { extraArg: boolean…
Helios
  • 191
  • 1
  • 5
13
votes
2 answers

Add GCC options to top of C source file

Is is possible to put something at the top of the C source file, like // GCC_OPTIONS=-g,-Wall that will add those options automatically to gcc every time you compile this file?
Nick
  • 187
  • 2
  • 6
13
votes
4 answers

GCC pragma to add/remove compiler options in a source file

I have developed a cross-platform library which makes fair use of type-punning in socket communications. This library is already being used in a number of projects, some of which I may not be aware of. Using this library incorrectly can result in…
John Dibling
  • 99,718
  • 31
  • 186
  • 324
12
votes
1 answer

How to see macro expansions step-by-step?

It seems Eclipse allows user to "see the expansion Step-by-Step" by pressing F2. I like this awesome feature. But can I do the same thing with just gcc or clang (or any tool)? -E option makes all macros fully expanded. So I haven't found any…
cshu
  • 5,654
  • 28
  • 44
11
votes
1 answer

GCC equivalent to VC's floating point model switch?

Does GCC have an equivalent compiler switch to VC's floating point model switch (/fp)? In particular, my application benefits from compiling with /fp:fast and precision is not a big deal, how should I compile it with GCC?
uj2
  • 2,255
  • 2
  • 21
  • 32
11
votes
3 answers

how to turn on icc/icpc warnings?

I installed Intel Compiler composer_xe_2013_sp1.3.174 on Linux. I am confused about the icc warnings. Feed icc with a simple program main.c as below: int main(int argc, char **argv) { int a = 1; unsigned int b = -22; if (b = a) { } } I…
Conghui He
  • 299
  • 4
  • 9
1
2
3
16 17