Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 761aeb43 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 21845 into eclair

* changes:
  Allow redefinition of macros.
parents 9d129689 815d8b8f
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -3292,6 +3292,7 @@ class Compiler : public ErrorSink {
    intptr_t loc; // local variable index
    char* glo;  // global variable index
    String mTokenString;
    bool mbSuppressMacroExpansion;
    char* dptr; // Macro state: Points to macro text during macro playback.
    int dch;    // Macro state: Saves old value of ch during a macro playback.
    char* pGlobalBase;
@@ -3726,6 +3727,7 @@ class Compiler : public ErrorSink {
                inp();
            }
            tok = mTokenTable.intern(mTokenString.getUnwrapped(), mTokenString.len());
            if (! mbSuppressMacroExpansion) {
                // Is this a macro?
                char* pMacroDefinition = mTokenTable[tok].mpMacroDefinition;
                if (pMacroDefinition) {
@@ -3735,6 +3737,7 @@ class Compiler : public ErrorSink {
                    inp();
                    next();
                }
            }
        } else {
            inp();
            if (tok == '\'') {
@@ -3809,7 +3812,9 @@ class Compiler : public ErrorSink {
    }

    void doDefine() {
        mbSuppressMacroExpansion = true;
        next();
        mbSuppressMacroExpansion = false;
        tokenid_t name = tok;
        String* pName = new String();
        if (ch == '(') {
@@ -4957,6 +4962,7 @@ class Compiler : public ErrorSink {
        mCompileResult = 0;
        mLineNumber = 1;
        mbBumpLine = false;
        mbSuppressMacroExpansion = false;
    }

    void setArchitecture(const char* architecture) {
+1 −0
Original line number Diff line number Diff line
// Simple tests of the C preprocessor

#define A 1
#define A (4 / 2)
#define B 1 // This is a comment. With a / in it.