Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main.cc

    ra16764a6 rcbbd5b48  
    1 
    21//
    32// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
     
    1110// Created On       : Fri May 15 23:12:02 2015
    1211// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Tue Oct 31 12:22:40 2017
    14 // Update Count     : 445
     12// Last Modified On : Wed May  2 14:59:02 2018
     13// Update Count     : 490
    1514//
    1615
     
    3534#include "CodeTools/DeclStats.h"            // for printDeclStats
    3635#include "CodeTools/TrackLoc.h"             // for fillLocations
     36#include "Common/CompilerError.h"           // for CompilerError
     37#include "Common/Heap.h"
    3738#include "Common/PassVisitor.h"
    38 #include "Common/CompilerError.h"           // for CompilerError
    3939#include "Common/SemanticError.h"           // for SemanticError
    4040#include "Common/UnimplementedError.h"      // for UnimplementedError
     
    175175        signal( SIGABRT, sigAbortHandler );
    176176
     177        // std::cout << "main" << std::endl;
     178        // for ( int i = 0; i < argc; i += 1 ) {
     179        //      std::cout << '\t' << argv[i] << std::endl;
     180        // } // for
     181
    177182        parse_cmdline( argc, argv, filename );                          // process command-line arguments
    178183        CodeGen::FixMain::setReplaceMain( !nomainp );
     
    354359                OPTPRINT( "end" )
    355360
     361
    356362                if ( output != &cout ) {
    357363                        delete output;
     
    384390
    385391        deleteAll( translationUnit );
     392        HeapStats::printStats();
    386393        return 0;
    387394} // main
     
    416423        opterr = 0;                                                                                     // (global) prevent getopt from printing error messages
    417424
     425        bool Werror = false;
    418426        int c;
    419         while ( (c = getopt_long( argc, argv, "abBcCdefgGlLmnNpqrstTvyzZD:F:", long_opts, &long_index )) != -1 ) {
     427        while ( (c = getopt_long( argc, argv, "abBcCdefgGlLmnNpqrstTvwW:yzZD:F:", long_opts, &long_index )) != -1 ) {
    420428                switch ( c ) {
    421429                  case Ast:
     
    453461                        yydebug = true;
    454462                        break;
    455                   case 'G':                   // dump AST after instantiate generics
     463                  case 'G':                                                                             // dump AST after instantiate generics
    456464                        genericsp = true;
    457465                        break;
     
    501509                  case 'v':                                                                             // dump AST after decl validation pass
    502510                        validp = true;
     511                        break;
     512                  case 'w':
     513                        SemanticWarning_SuppressAll();
     514                        break;
     515                  case 'W':
     516                        if ( strcmp( optarg, "all" ) == 0 ) {
     517                                SemanticWarning_EnableAll();
     518                        } else if ( strcmp( optarg, "error" ) == 0 ) {
     519                                Werror = true;
     520                        } else {
     521                                char * warning = optarg;
     522                                Severity s;
     523                                if ( strncmp( optarg, "no-", 3 ) == 0 ) {
     524                                        warning += 3;
     525                                        s = Severity::Suppress;
     526                                } else {
     527                                        s = Severity::Warn;
     528                                } // if
     529                                SemanticWarning_Set( warning, s );
     530                        } // if
    503531                        break;
    504532                  case 'y':                                                                             // dump AST on error
     
    530558                } // switch
    531559        } // while
     560
     561        if ( Werror ) {
     562                SemanticWarning_WarningAsError();
     563        } // if
     564        // for ( const auto w : WarningFormats ) {
     565        //      cout << w.name << ' ' << (int)w.severity << endl;
     566        // } // for
    532567} // parse_cmdline
    533568
Note: See TracChangeset for help on using the changeset viewer.