preprocessor

Pycparser not working on preprocessed code

时光毁灭记忆、已成空白 提交于 2019-12-06 13:02:36
问题 I need to use pycparser on preprocessed C code (the results produced by 'gcc -E'). However I am currently running into issue that I can't understand or solve. I am using the provided samples year2.c and func_defs.py, which i modified to use a variety of preprocessors and fake libraries to no avail. Maybe some of you can look into this and see if you can reproduce/solve the issue. I will append all necessary code. The errors were generated using year2.c (regular sample file) and year2.i ('gcc

How do I find the type declaration of an identifier using the Java Tree Compiler API?

对着背影说爱祢 提交于 2019-12-06 12:45:31
I have the name of a variable/identifier, say, x , and the JCCompilationUnit and Scope . Is there a way to find the type of x ? public Symbol getSymbol(CompilationUnitTree cut, JCStatement stmt, List<JCExpression> typeParams, Name varName, List<JCExpression> args) { java.util.List<Type> typeSyms = getArgTypes(typeParams, cut, stmt); java.util.List<Type> argsSyms = getArgTypes(args, cut, stmt); final Scope scope = getScope(cut, stmt); Symbol t = contains(scope, typeSyms, varName, argsSyms); //first lookup scope for all public identifiers TypeElement cl = scope.getEnclosingClass(); while (t ==

Need some assistance with TFS2010 + an automated Build + 'Configurations to Build = Debug'

你离开我真会死。 提交于 2019-12-06 11:51:38
really. weird. shiz. When I do a TFS Team Build (with Remote Deploy ), some #if DEBUG preprocessor directives code I have on a web page does not get called. When i manually one-click deploy (remote deploy) the preprocessor directive code works. When I debug locally, the code also works. So - problem looks to be related to my configuration settings for the Build Template i have (I think??). So, this is what I have :- Nothing too hard. That says ... Please kind Compiler. Build my project (read: project, NOT solution) in 'DEBUG' mode. The code i have is the following :- #if DEBUG Log.Debug("We

Delphi 7 macro preprocessor support

一曲冷凌霜 提交于 2019-12-06 08:54:17
Is there a macro preprocessor for Delphi 7? There isn't one built in so maybe there's a possibilty to use a third party or some other languages preprocessor (like c preprocessor). If there's one, how to set it up for Delphi 7? I'm trying to do function inlining (for speed). Macro preprocessor seems to be the only easy option for delphi. Thanks, Egon You can always run an external macro processor, such as m4 or even (shudder) cpp on your code before you compile it. I wouldn't recommend this however - in my experience the benefits of inlining (which is what you seem to want to do) are quite

Pre-Processing using m4

走远了吗. 提交于 2019-12-06 08:17:10
I am writing a pre-processor for Free-Pascal (Course Work) using m4 . I was reading the thread at stackoverflow here and from there reached a blog which essentially shows the basic usage of m4 for pre-processing for C . The blogger uses a testing C file test.c.m4 like this: #include define(`DEF', `3') int main(int argc, char *argv[]) { printf("%d\n", DEF); return 0; } and generates processed C file like this using m4 , which is fine. $ m4 test.c.m4 > test.c $ cat test.c #include <stdio.h> int main(int argc, char *argv[]) { printf("%dn", 3); return 0; } My doubts are: 1. The programmer will

Automatic Semicolon Insertion in JavaScript without parsing [closed]

穿精又带淫゛_ 提交于 2019-12-06 05:50:19
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 8 months ago . I'm writing a JavaScript preprocessor which automatically inserts semicolons in places where it's necessary. Don't ask why. Now I know that the general way to tackle this problem is to write a JavaScript parser and add semicolons where necessary according to the rules in the

Assertions in Fortran

无人久伴 提交于 2019-12-06 03:47:27
问题 Does Fortran have a standard function/keyword equivalent for C assert ? I could not find assert mentioned in Fortran2003 standard I have. I have found few ways how to use pre-processor, but in this answer it is suggested to write own assertions. Is it possible to create such user function/subroutine without using pre-processor? I expect that these assertions are disabled for release builds. 回答1: To my knowledge, there is no such statement or function/subroutine in Standard Fortran. But - as

HTML Preprocessor?

放肆的年华 提交于 2019-12-06 01:24:48
问题 Is there a HTML preprocessor that can do simple page processing similar to Server Side Includes, but produce a static set of HTML pages? 回答1: I think they are called pre-processors. http://htmlhelp.com/links/preprocessors.html 回答2: It's a HTML Pre-processor. More here : htmlpp 来源: https://stackoverflow.com/questions/5462610/html-preprocessor

Stringify macro with GNU gfortran

こ雲淡風輕ζ 提交于 2019-12-05 15:25:01
How can I stringify a preprocessor macro with GNU gfortran? I would like to pass a macro definition to GNU gfortran which will then be used as a string in the code. Effectively I would like to do this: program test implicit none character (len=:), allocatable :: astring astring = MYMACRO write (*, *) astring end program test and then build with: gfortran -DMYMACRO=hello test.F90 I tried creating various macro, for example: #define STRINGIFY_(x) #x #define STRINGIFY(x) STRINGIFY_(x) ... astring = STRINGIFY(MYMACRO) but this doesn't work with the gfortran preprocessor. I also tried using a

xcconfig: Different preprocessor macros for Debug/Release

霸气de小男生 提交于 2019-12-05 13:46:41
I have created and applied a simple .xcconfig file containing GCC_PREPROCESSOR_DEFINITIONS[config=Debug] = FOODEBUG GCC_PREPROCESSOR_DEFINITIONS[config=Release] = FOORELEASE and main.cpp containing #include <iostream> // This warning IS shown #if DEBUG #warning DEBUG is set to 1 #endif // This warning IS NOT shown #ifdef FOODEBUG #warning FOODEBUG is set #endif // This warning IS NOT shown #ifdef FOORELEASE #warning FOORELEASE is set #endif int main(int argc, const char * argv[]) { // insert code here... std::cout << "Hello, World!\n"; return 0; } Now I'm wondering why in main.cpp, neither