24053

C preprocessor library

Question:

I have a task of developing source analysis tool for <strong>C</strong> programs, and I need to pre-process code before the analysis itself. I was wondering what is the best library for this. I need something light-weight and portable.

Answer1:

Instead of rolling out your own, why not use cpp that's part of the gcc suite: <a href="http://gcc.gnu.org/onlinedocs/gcc-4.6.1/cpp/" rel="nofollow">http://gcc.gnu.org/onlinedocs/gcc-4.6.1/cpp/</a>

<pre class="lang-none prettyprint-override">CPP(1) GNU CPP(1) NAME cpp - The C Preprocessor SYNOPSIS cpp [-Dmacro[=defn]...] [-Umacro] [-Idir...] [-iquotedir...] [-Wwarn...] [-M|-MM] [-MG] [-MF filename] [-MP] [-MQ target...] [-MT target...] [-P] [-fno-working-directory] [-x language] [-std=standard] infile outfile Only the most useful options are listed here; see below for the remainder. DESCRIPTION The C preprocessor, often known as cpp, is a macro processor that is used automatically by the C compiler to transform your program before compilation. It is called a macro processor because it allows you to define macros, which are brief abbreviations for longer constructs.

Recommend

  • Caught OutOfMemoryException makes debugging difficult
  • Linker error with Boost 1.60 and VS 2013 on x64
  • rspec view stubs and partials
  • `as.na` function
  • How to share image to viber app via file provider?
  • Move an 8 bit image using VHDL
  • Transforming Calendar Quarter to Financial Quarter
  • iPhone/iPad: animated splash screen?
  • Laravel 5 multi level category
  • Multiple Rows for same identifier
  • Use a keras model in a custom keras loss
  • div is displayed centered in Firefox, but not in IE
  • Java Regex Finding digits in a String
  • HTTP Status 500 - Error instantiating servlet class org.springframework.web.servlet.DispatcherServle
  • Java Processbuilder Stream to Python-Script
  • Fixing corrupt encoding (with Python)
  • C++ Time measurement of functions
  • How to get rid of Meteor template flickers
  • How to run Daphne Server (Django Channels) & workers in the background?
  • Draw 9 patch dotted /dashed line on Android
  • How to get “crispEdges” for SVG text?
  • Showing image on a acro text field position
  • Sample deviceQuery cuda program
  • Why do you need 2 Javascript files for cross-platform Cordova plugin?
  • select an input by value?
  • Ember.js + JQuery-UI Tooltip - Tooltip does not reflect the model / controller changes
  • Separating definition/instantiation of template classes without 'extern'
  • trigger ontouch event programmatically
  • Change the color of the legend text in forceNetwork for networkD3
  • Annotate objects in a queryset with next and previous object ids
  • How to split wav file into two or more parts using c#
  • Content-Type alternative in MQTT
  • Why is ordered choice in pyparsing failing for my use case?
  • How to encrypt Connectionstring written in web.config from codebehind?
  • Call Microservice from another Microservice within Docker