Changeset 49d3128


Ignore:
Timestamp:
Nov 21, 2019, 3:53:39 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
2909b51, c701332a
Parents:
1a69a90
Message:

cfa command now properly supports -fdiagnostics-color and -fno-diagnostics-color

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • driver/cc1.cc

    r1a69a90 r49d3128  
    335335        #endif // __DEBUG_H__
    336336
     337        enum {
     338                Color_Auto   = 0,
     339                Color_Always = 1,
     340                Color_Never  = 2,
     341        } color_arg = Color_Auto;
     342
     343        const char * color_names[3] = { "--colors=auto", "--colors=always", "--colors=never" };
     344
    337345        // process all the arguments
    338346
     
    341349                if ( prefix( arg, "-" ) ) {
    342350                        // strip inappropriate flags
     351
     352                        if ( prefix( arg, "-fdiagnostics-color=" ) ) {
     353                                string choice = arg.substr(20);
     354                                     if(choice == "always") color_arg = Color_Always;
     355                                else if(choice == "never" ) color_arg = Color_Never;
     356                                else if(choice == "auto"  ) color_arg = Color_Auto;
     357                        } else if ( arg == "-fno-diagnostics-color" ) {
     358                                color_arg = Color_Auto;
     359                        }
    343360
    344361                        if ( arg == "-quiet" || arg == "-version" || arg == "-fpreprocessed" ||
     
    440457                        cargs[ncargs++] = cfa_cpp_out.c_str();
    441458                } // if
     459
     460                cargs[ncargs++] = color_names[color_arg];
     461
    442462                cargs[ncargs] = nullptr;                                                // terminate argument list
    443463
  • src/main.cc

    r1a69a90 r49d3128  
    431431
    432432static const char * description[] = {
    433         "Use color in diagnostics. WHEN is ‘never’, ‘always’, or ‘auto’.",// -c
    434         "wait for gdb to attach",                                                                       // -g
    435         "print help message",                                                           // -h
    436         "generate libcfa.c",                                                            // -l
    437         "generate line marks",                                                          // -L
    438         "do not replace main",                                                          // -m
    439         "do not generate line marks",                                           // -N
    440         "do not read prelude",                                                          // -n
     433        "diagnostic color: never, always, or auto.",          // -c
     434        "wait for gdb to attach",                             // -g
     435        "print help message",                                 // -h
     436        "generate libcfa.c",                                  // -l
     437        "generate line marks",                                // -L
     438        "do not replace main",                                // -m
     439        "do not generate line marks",                         // -N
     440        "do not read prelude",                                // -n
    441441        "generate prototypes for prelude functions",            // -p
    442         "print",                                                                                        // -P
     442        "print",                                              // -P
    443443        "<directory> prelude directory for debug/nodebug",      // no flag
    444444        "<option-list> enable profiling information:\n          counters,heap,time,all,none", // -S
    445         "building cfa standard lib",                                                                    // -t
    446         "",                                                                                                     // -w
    447         "",                                                                                                     // -W
    448         "",                                                                                                     // -D
     445        "building cfa standard lib",                          // -t
     446        "",                                                   // -w
     447        "",                                                   // -W
     448        "",                                                   // -D
    449449}; // description
    450450
Note: See TracChangeset for help on using the changeset viewer.