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;








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.










share|improve this question



















  • 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






  • 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

















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.










share|improve this question



















  • 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






  • 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













0












0








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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 tries gcc -std=c90 Did it work? If not, try gcc -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





    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





    @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












1 Answer
1






active

oldest

votes


















0














Use grep -- -std= Makefile



ctags: no way



If you are looking for something smarter... bad luck.






share|improve this answer






















    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
    );



    );













    draft saved

    draft discarded


















    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









    0














    Use grep -- -std= Makefile



    ctags: no way



    If you are looking for something smarter... bad luck.






    share|improve this answer



























      0














      Use grep -- -std= Makefile



      ctags: no way



      If you are looking for something smarter... bad luck.






      share|improve this answer

























        0












        0








        0







        Use grep -- -std= Makefile



        ctags: no way



        If you are looking for something smarter... bad luck.






        share|improve this answer













        Use grep -- -std= Makefile



        ctags: no way



        If you are looking for something smarter... bad luck.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered May 22 at 9:38









        PolluksPolluks

        1261 silver badge10 bronze badges




        1261 silver badge10 bronze badges


















            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.



















            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript