Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the use of -fsyntax-only option in gcc command?

Tags:

gcc

I read about the -fsyntax-only option in gcc command's man page. I understand it shows errors of missing header files and it ignore the user coding errors. I need to know whether my understanding is correct or not?, also I need to know more about this option. So can any one explain about this option?

like image 813
Nivetha Jaishankar Avatar asked Oct 18 '16 10:10

Nivetha Jaishankar


People also ask

What is the use of option in compiler?

clause. Compilers options (− x on Linux, and /Qx on Microsoft Windows) control which instructions the compiler uses within a function, while the processor(…) clause controls creation of non-standard functions using wider registers (YMM or ZMM) for passing SIMD data for parameters and results.

What is option in c compiler?

Option Syntaxcc accepts a list of C source files and object files contained in the list of files specified by filenames. The resulting executable code is placed in a. out , unless the -o option is used. In this case, the code is placed in the file named by the -o option.

What is fPIC option in GCC?

fPIC option in GCC enables the address of shared libraries to be relative so that the executable is independent of the position of libraries. This enables one to share built library which has dependencies on other shared libraries. fPIC stands for "force Position Independent Code".


Video Answer


1 Answers

-fsyntax-only prevents the compiler from generating any object code. Other than that it does the same thing as without this flag.

from Wikipedia

A compiler is likely to perform many or all of the following operations: lexical analysis, preprocessing, parsing, semantic analysis (syntax-directed translation), code generation, and code optimization.

It may still do the last 2 of those, because some errors are only found during optimization, but the results will be discarded, or it skips these steps entirely.

It is mainly used to get error and warning messages about the code in question. (It won’t ignore user coding errors)

like image 103
Darklighter Avatar answered Sep 23 '22 13:09

Darklighter