VirtualBox

Changeset 100555 in vbox


Ignore:
Timestamp:
Jul 12, 2023 9:06:53 PM (21 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
158381
Message:

VBoxCPP: Added help text, a --mode option and fixed a copy&paste bug in some yet unreachable code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bldprogs/VBoxCPP.cpp

    r98103 r100555  
    32883288        case kVBCppExprKind_Ternary:
    32893289            vbcppExprDestoryTree(pExpr->u.Ternary.pExpr);
    3290             vbcppExprDestoryTree(pExpr->u.Ternary.pExpr);
     3290            vbcppExprDestoryTree(pExpr->u.Ternary.pTrue);
    32913291            vbcppExprDestoryTree(pExpr->u.Ternary.pFalse);
    32923292            break;
     
    49124912                /** @todo Search for the include file and push it onto the input stack.
    49134913                 *  Not difficult, just unnecessary rigth now. */
    4914                 rcExit = vbcppError(pThis, "Includes are fully implemented");
     4914                rcExit = vbcppError(pThis, "Sorry, includes are not yet implemented");
    49154915            }
    49164916            else if (pThis->enmIncludeAction == kVBCppIncludeAction_PassThru)
     
    53455345        { "--strip-comments",           'c',                    RTGETOPT_REQ_NOTHING },
    53465346        { "--D-strip",                  'd',                    RTGETOPT_REQ_NOTHING },
     5347#define OPT_MODE    1000
     5348        { "--mode",                     OPT_MODE,               RTGETOPT_REQ_STRING },
    53475349    };
    53485350
     
    53695371            case 'd':
    53705372                vbcppSetMode(pThis, kVBCppMode_SelectiveD);
     5373                break;
     5374
     5375            case OPT_MODE:
     5376                if (   strcmp(ValueUnion.psz, "standard") == 0
     5377                    || strcmp(ValueUnion.psz, "std") == 0)
     5378                    vbcppSetMode(pThis, kVBCppMode_Standard);
     5379                else if (   strcmp(ValueUnion.psz, "selective") == 0
     5380                         || strcmp(ValueUnion.psz, "sel") == 0)
     5381                    vbcppSetMode(pThis, kVBCppMode_Selective);
     5382                else if (   strcmp(ValueUnion.psz, "selective-D") == 0
     5383                         || strcmp(ValueUnion.psz, "D-strip") == 0)
     5384                    vbcppSetMode(pThis, kVBCppMode_SelectiveD);
     5385                else
     5386                    return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unknown mode '%s'!", ValueUnion.psz);
    53715387                break;
    53725388
     
    53945410
    53955411            case 'h':
    5396                 RTPrintf("No help yet, sorry\n");
     5412                RTPrintf("Usage: VBoxCPP [options] <input.c> [output.ii]\n"
     5413                         "\n"
     5414                         "Options:\n"
     5415                         "  --mode={mode}\n"
     5416                         "    Sets the processing mode and asscoiated defaults:\n"
     5417                         "      - selective   / sel: (default)\n"
     5418                         "          Selectively applying the defines from the command line\n"
     5419                         "          and preserving the rest.\n"
     5420                         "      - selective-D / D-strip:\n"
     5421                         "          Selectively applying the defines from the command line\n"
     5422                         "          and removing things DTrace doesn't like.\n"
     5423                         "      - standard    / std:\n"
     5424                         "          Standard C preprocesing.  This is incomplete as, among other\n"
     5425                         "          things, include processing has not yet been implemented.\n"
     5426                         "  --D-strip\n"
     5427                         "    Alias for --mode=selective-D\n"
     5428                         "  --define={macro}[=val], -D{macro}[=val]\n"
     5429                         "    Defines a macro.\n"
     5430                         "  --undefine={macro}, -U{macro}\n"
     5431                         "    Undefines a macro.\n"
     5432                         "  --include-dir={dir}, -I{dir}\n"
     5433                         "    Adds {dir} to the list of include directories that should\n"
     5434                         "    be searched for header files."
     5435                         "  --keep-comments, -C\n"
     5436                         "    Keep comments unchanged in the output.\n"
     5437                         "  --strip-comments, -c\n"
     5438                         "    Strip comments in the output. (default)\n"
     5439                         "\n"
     5440                         "This is not a complete C preprocessor implementation (yet), as its use is\n"
     5441                         "mainly to selectively apply and eliminate defines and/or things are DTrace\n"
     5442                         "finds problematic.  Among the missing features are:\n"
     5443                         "  - Support for ternary expressions.\n"
     5444                         "  - Including header files (in standard mode).\n"
     5445                         "  - +++\n"
     5446                         );
    53975447                *pfExit = true;
    53985448                return RTEXITCODE_SUCCESS;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette