tools to help minimize usage of macros in C++ programs [closed] - c++

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
Different C++ style guides deprecate the use of C Preprocessor macros.
I know there are tools which help detect errors due to macro usage (CPPCHECKER, Check), and tools which provide refactoring in the presence of preprocessor directives (CSCout, XRefactory).
I was wondering if there are any refactoring tools that suggest alternatives (like inline functions, constant expressions) to macros in C++ programs.

Years later it seems that your work is being used as a basis for such tools since there were none present before.
Macronator which later became part of Cevelop IDE is a tool that can refactor object-like and function-like macros to equivalent c++11 expressions. They reference "The demacrofier" paper by by Kumar, Sutton, and Stroustrup as a base for their software. I used it to remove ~15k macros from a codebase.

Related

How to identify executable lines in C++ code [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
How would one go about automatically identifying lines of C++ source files that contain (potentially) executable code? By potentially excecutable code, I mean code that might have been executable had its template been instantiated.
I expect it would be a purely syntactic determination. I'm not even completely sure this is even possible in all circumstances, but I guess it is.
Note that this is not the primary function of a dynamic coverage checker (although some may in fact perform this...)
(The goal is to enable a coverage checker to distinguish executable lines from comments, empty lines, type declarations, and the like.)
If you work with CLion IDE, you can use the pluging C/C++ Coverage.

Conversion of C++ to Fortran 90 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Is there a tool that converts C++ code into fortran? Please state any possible deficiency of the tool you use.
I know it sounds silly but I do have a C++ code that calls a big Fortran code inside and I need to to use OpenMP. I am trying to keep the parallel region only inside Fortran (because there are many COMMON blocks and EQUIVALENCEs used) so I have to translate a few hundreds of lines of C++ functions to Fortran.
Depending on the compiler (such as the GNU compilers), you're actually able to compile C, C++, Fortran, etc. code together. This is so you don't actually have to translate or rewrite that code. C++ Forum Answer

Parse c++ and extract all used types and functions [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I want to write a program that runs before Visual Studio compiles my project.
It needs to extract only the types, names and parameters of all functions, classes, structs, enums my project is using from files in a specific folder (/sdk) and copy those into a new folder (/sdkmin)
So I basically want to have a program that minifies the sdk my project is using.
Is there any decent library that allows me to do that without having to write my own parser/lexer/whatever?
I think what you should do is look at some clang tools like "clang-format", "include-what-you-use", etc., which build on the clang AST front-end stuff to do various interesting things. This will provide the lexer and parser for you, which would indeed take a very long time if you started from scratch.
Github mirror here: https://github.com/llvm-mirror/clang

Is there any c++ IDE checking coding style as Pycharm does? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
Pycharm has a very nice feature to check coding style according to PEP8 conventions. It's good for python beginners to write decent code from the very beginning. I am wondering if there's any c++ IDE implementing similar features, for instance, checking google c++ coding style?
Yes, there is.
When google released their c++ coding style, they also provide a python script named cpplint for style checking.
http://google-styleguide.googlecode.com/svn/trunk/cpplint/
If you can embed this script into your IDE, you can employ it to do code style checking.
There is an article that explains how to integrate cpplint into Visual Studio 2012 (guess also applicable to other versions).
http://sww-it.ru/2015-01-14/1199

Translating new C++ to old C++ [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
C++11 and C++14 introduce a lot of new features that make programmers' lives easier. However, in various environments (e.g. CUDA), support for the most modern C++ features may be weak or nonexistent.
Many of these features (e.g. auto, decltype, constexpr, variadic templates) do not add any challenges to code generation, and really only require a parser that understands the constructs. In principle, unless honestly new functionality (e.g. thread_local) is used, there could be a tool that takes C++14 code and converts it into something that could be built with something that only understands the C++03 language.
Does such a tool exist? (or are my presumptions way off base?)
AFAIK no such tool exist. Some C++ compilers (the original Cfront, and perhaps Comeau C++) generated C code.
You might customize GCC (e.g. using MELT) to translate the internal Gimple representation to a small subset of C++. This is a lot of work (and the emitted C++ won't be portable).
Maybe you should consider OpenACC