Identify version of C fileHow to get rid of `deprecated conversion from string constant to ‘char*’` warnings in GCC?Vim and Ctags tips and tricksUsing GCC to produce readable assembly?Improve INSERT-per-second performance of SQLite?Can code that is valid in both C and C++ produce different behavior when compiled in each language?What is the difference between C, C99, ANSI C and GNU C?Why does GCC generate 15-20% faster code if I optimize for size instead of speed?Forcing compiler to C99 standardCompiling an application for use in highly radioactive environmentsIs using an outdated C compiler a security risk?
What happens if an IRB mistakenly approves unethical research?
My current job follows "worst practices". How can I talk about my experience in an interview without giving off red flags?
Span command across LaTeX environments
Inverse Colombian Function
Film where a boy turns into a princess
Are gangsters hired to attack people at a train station classified as a terrorist attack?
Why can't a country print its own money to spend it only abroad?
Why did NASA use Imperial units?
Bug in Lualatex: not printing characters from calculation
Travelling from Venice to Budapest, making a stop in Croatia
Why does the salt in the oceans not sink to the bottom?
How may I shorten this shell script?
how to add 1 milliseconds on a datetime string?
What's the 1 inch size square knob sticking out of wall?
Can't understand how static works exactly
Can you drop a weapon/item when it is not your turn?
Extrapolation v. Interpolation
When were "acrobatics" introduced at weddings?
Why is a dedicated QA team member necessary?
What would be the side effects on the life of a person becoming indestructible?
What is the purpose of this "red room" in "Stranger Things"?
Company requiring me to let them review research from before I was hired
Impact of throwing away fruit waste on a peak > 3200 m above a glacier
Are symplectomorphisms of Weil–Petersson symplectic form induced from surface diffeomorphisms?
Identify version of C file
How to get rid of `deprecated conversion from string constant to ‘char*’` warnings in GCC?Vim and Ctags tips and tricksUsing GCC to produce readable assembly?Improve INSERT-per-second performance of SQLite?Can code that is valid in both C and C++ produce different behavior when compiled in each language?What is the difference between C, C99, ANSI C and GNU C?Why does GCC generate 15-20% faster code if I optimize for size instead of speed?Forcing compiler to C99 standardCompiling an application for use in highly radioactive environmentsIs using an outdated C compiler a security risk?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
For a project I need to find if a c file has code that requires >=C11 or C99 compiler. Can this be done with gcc, or ctags?
Basically I need to identify the minimum version of compiler required to compile the file. I have tried different tools including ctags etc.
c gcc c99 ctags c11
add a comment |
For a project I need to find if a c file has code that requires >=C11 or C99 compiler. Can this be done with gcc, or ctags?
Basically I need to identify the minimum version of compiler required to compile the file. I have tried different tools including ctags etc.
c gcc c99 ctags c11
9
You could write a shellscript/batch file that triesgcc -std=c90
Did it work? If not, trygcc -std=c99
. Then C11.
– Lundin
Mar 26 at 15:17
1
@Lundin's suggestion or something substantially equivalent is the only option I see. Solving the problem requires attempting to interpret the given source according to various language standards, and a program that performs that job (one standard at a time) is what a compiler is. Do note, however, that there is code that will be accepted by various C compilers that does not conform to any of the language standards.
– John Bollinger
Mar 26 at 15:44
1
I'd add a-pedantic-errors
and maybe a-Wall
to the compile options.
– AShelly
Mar 26 at 17:07
add a comment |
For a project I need to find if a c file has code that requires >=C11 or C99 compiler. Can this be done with gcc, or ctags?
Basically I need to identify the minimum version of compiler required to compile the file. I have tried different tools including ctags etc.
c gcc c99 ctags c11
For a project I need to find if a c file has code that requires >=C11 or C99 compiler. Can this be done with gcc, or ctags?
Basically I need to identify the minimum version of compiler required to compile the file. I have tried different tools including ctags etc.
c gcc c99 ctags c11
c gcc c99 ctags c11
edited Mar 26 at 15:18
Lundin
117k17 gold badges170 silver badges280 bronze badges
117k17 gold badges170 silver badges280 bronze badges
asked Mar 26 at 15:14
Faraz KhanFaraz Khan
41 bronze badge
41 bronze badge
9
You could write a shellscript/batch file that triesgcc -std=c90
Did it work? If not, trygcc -std=c99
. Then C11.
– Lundin
Mar 26 at 15:17
1
@Lundin's suggestion or something substantially equivalent is the only option I see. Solving the problem requires attempting to interpret the given source according to various language standards, and a program that performs that job (one standard at a time) is what a compiler is. Do note, however, that there is code that will be accepted by various C compilers that does not conform to any of the language standards.
– John Bollinger
Mar 26 at 15:44
1
I'd add a-pedantic-errors
and maybe a-Wall
to the compile options.
– AShelly
Mar 26 at 17:07
add a comment |
9
You could write a shellscript/batch file that triesgcc -std=c90
Did it work? If not, trygcc -std=c99
. Then C11.
– Lundin
Mar 26 at 15:17
1
@Lundin's suggestion or something substantially equivalent is the only option I see. Solving the problem requires attempting to interpret the given source according to various language standards, and a program that performs that job (one standard at a time) is what a compiler is. Do note, however, that there is code that will be accepted by various C compilers that does not conform to any of the language standards.
– John Bollinger
Mar 26 at 15:44
1
I'd add a-pedantic-errors
and maybe a-Wall
to the compile options.
– AShelly
Mar 26 at 17:07
9
9
You could write a shellscript/batch file that tries
gcc -std=c90
Did it work? If not, try gcc -std=c99
. Then C11.– Lundin
Mar 26 at 15:17
You could write a shellscript/batch file that tries
gcc -std=c90
Did it work? If not, try gcc -std=c99
. Then C11.– Lundin
Mar 26 at 15:17
1
1
@Lundin's suggestion or something substantially equivalent is the only option I see. Solving the problem requires attempting to interpret the given source according to various language standards, and a program that performs that job (one standard at a time) is what a compiler is. Do note, however, that there is code that will be accepted by various C compilers that does not conform to any of the language standards.
– John Bollinger
Mar 26 at 15:44
@Lundin's suggestion or something substantially equivalent is the only option I see. Solving the problem requires attempting to interpret the given source according to various language standards, and a program that performs that job (one standard at a time) is what a compiler is. Do note, however, that there is code that will be accepted by various C compilers that does not conform to any of the language standards.
– John Bollinger
Mar 26 at 15:44
1
1
I'd add a
-pedantic-errors
and maybe a -Wall
to the compile options.– AShelly
Mar 26 at 17:07
I'd add a
-pedantic-errors
and maybe a -Wall
to the compile options.– AShelly
Mar 26 at 17:07
add a comment |
1 Answer
1
active
oldest
votes
Use grep -- -std= Makefile
ctags: no way
If you are looking for something smarter... bad luck.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55360552%2fidentify-version-of-c-file%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Use grep -- -std= Makefile
ctags: no way
If you are looking for something smarter... bad luck.
add a comment |
Use grep -- -std= Makefile
ctags: no way
If you are looking for something smarter... bad luck.
add a comment |
Use grep -- -std= Makefile
ctags: no way
If you are looking for something smarter... bad luck.
Use grep -- -std= Makefile
ctags: no way
If you are looking for something smarter... bad luck.
answered May 22 at 9:38
PolluksPolluks
1261 silver badge10 bronze badges
1261 silver badge10 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55360552%2fidentify-version-of-c-file%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
9
You could write a shellscript/batch file that tries
gcc -std=c90
Did it work? If not, trygcc -std=c99
. Then C11.– Lundin
Mar 26 at 15:17
1
@Lundin's suggestion or something substantially equivalent is the only option I see. Solving the problem requires attempting to interpret the given source according to various language standards, and a program that performs that job (one standard at a time) is what a compiler is. Do note, however, that there is code that will be accepted by various C compilers that does not conform to any of the language standards.
– John Bollinger
Mar 26 at 15:44
1
I'd add a
-pedantic-errors
and maybe a-Wall
to the compile options.– AShelly
Mar 26 at 17:07