Changeset 44bca7f


Ignore:
Timestamp:
May 2, 2018, 3:24:46 PM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
6d539f83
Parents:
30dcc47
Message:

first attempt at warning control

Location:
src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/Common/SemanticError.h

    r30dcc47 r44bca7f  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Apr 19 17:52:03 2018
    13 // Update Count     : 19
     12// Last Modified On : Wed May  2 15:00:01 2018
     13// Update Count     : 23
    1414//
    1515
     
    4949};
    5050
    51 constexpr const WarningData WarningFormats[] = {
     51constexpr WarningData WarningFormats[] = {
    5252        {"self-assign"         , "self assignment of expression: %s"           , Severity::Warn},
    5353        {"reference-conversion", "rvalue to reference conversion of rvalue: %s", Severity::Warn},
  • src/driver/Makefile.am

    r30dcc47 r44bca7f  
    1111## Created On       : Sun May 31 08:49:31 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Fri Oct 28 13:46:06 2016
    14 ## Update Count     : 10
     13## Last Modified On : Mon Apr 30 17:44:17 2018
     14## Update Count     : 11
    1515###############################################################################
    1616
    1717# applies to both programs
    18 AM_CXXFLAGS = -Wall -O2 -g -std=c++14
     18AM_CXXFLAGS = -Wall -O2 -g -std=c++14 -I${abs_top_srcdir}/src
    1919if BUILD_NO_LIB
    2020else
  • src/driver/Makefile.in

    r30dcc47 r44bca7f  
    294294
    295295# applies to both programs
    296 AM_CXXFLAGS = -Wall -O2 -g -std=c++14 $(am__append_1) $(am__append_2) \
    297         $(am__append_3)
     296AM_CXXFLAGS = -Wall -O2 -g -std=c++14 -I${abs_top_srcdir}/src \
     297        $(am__append_1) $(am__append_2) $(am__append_3)
    298298cfa_SOURCES = cfa.cc
    299299
  • src/driver/cfa.cc

    r30dcc47 r44bca7f  
    1010// Created On       : Tue Aug 20 13:44:49 2002
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Feb  5 22:05:28 2018
    13 // Update Count     : 166
     12// Last Modified On : Wed May  2 14:32:08 2018
     13// Update Count     : 222
    1414//
    1515
     
    1919#include <unistd.h>                                                                             // execvp
    2020#include <string>                                                                               // STL version
    21 
     21#include <string.h>                                                                             // strcmp
     22
     23#include "Common/SemanticError.h"
    2224#include "config.h"                                                                             // configure info
    2325
     
    160162                                args[nargs] = argv[i];                                  // pass the argument along
    161163                                nargs += 1;
     164                        } else if ( arg == "-w" ) {
     165                                args[nargs] = argv[i];                                  // pass the argument along
     166                                nargs += 1;
     167                                args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + arg ) ).c_str(); // add the argument for cfa-cpp
     168                                nargs += 1;
     169                        } else if ( prefix( arg, "-W" ) ) {                     // check before next tests
     170                                if ( arg == "-Werror" || arg == "-Wall" ) {
     171                                        args[nargs] = argv[i];                          // pass the argument along
     172                                        nargs += 1;
     173                                        args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + arg ) ).c_str(); // add the argument for cfa-cpp
     174                                        nargs += 1;
     175                                } else {
     176                                        unsigned int adv = prefix( arg, "-Wno-" ) ? 5 : 2;
     177                                        args[nargs] = argv[i];                          // conditionally pass the argument along
     178                                        char * warning = argv[i] + adv;         // extract warning
     179                                        for ( const auto w : WarningFormats ) {
     180                                                if ( strcmp( warning, w.name ) == 0 ) { // replace the argument for cfa-cpp
     181                                                        args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + arg ) ).c_str();
     182                                                        break;
     183                                                } // if
     184                                        } // for
     185                                        nargs += 1;
     186                                } // if
    162187                        } else if ( prefix( arg, "-B" ) ) {
    163188                                Bprefix = arg.substr(2);                                // strip the -B flag
     
    247272                #if ! defined(HAVE_LIBCFA_RELEASE)
    248273                        if( !debug ) {
    249                                 cerr << "error: Option -nodebug is not available, libcfa was not installed." << endl;
     274                                cerr << "error: Option -nodebug is unavailable, libcfa was not installed." << endl;
    250275                                exit( EXIT_FAILURE );
    251276                                }
     
    253278                #if ! defined(HAVE_LIBCFA_DEBUG)
    254279                        if( debug ) {
    255                                 cerr << "error: Option -debug is not available, libcfa-d was not installed." << endl;
     280                                cerr << "error: Option -debug is unavailable, libcfa-d was not installed." << endl;
    256281                                exit( EXIT_FAILURE );
    257282                                }
  • src/main.cc

    r30dcc47 r44bca7f  
    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
     
    175174        signal( SIGABRT, sigAbortHandler );
    176175
     176        // std::cout << "main" << std::endl;
     177        // for ( int i = 0; i < argc; i += 1 ) {
     178        //      std::cout << '\t' << argv[i] << std::endl;
     179        // } // for
     180
    177181        parse_cmdline( argc, argv, filename );                          // process command-line arguments
    178182        CodeGen::FixMain::setReplaceMain( !nomainp );
     
    416420        opterr = 0;                                                                                     // (global) prevent getopt from printing error messages
    417421
     422        bool Werror = false;
    418423        int c;
    419         while ( (c = getopt_long( argc, argv, "abBcCdefgGlLmnNpqrstTvyzZD:F:", long_opts, &long_index )) != -1 ) {
     424        while ( (c = getopt_long( argc, argv, "abBcCdefgGlLmnNpqrstTvwW:yzZD:F:", long_opts, &long_index )) != -1 ) {
    420425                switch ( c ) {
    421426                  case Ast:
     
    453458                        yydebug = true;
    454459                        break;
    455                   case 'G':                   // dump AST after instantiate generics
     460                  case 'G':                                                                             // dump AST after instantiate generics
    456461                        genericsp = true;
    457462                        break;
     
    501506                  case 'v':                                                                             // dump AST after decl validation pass
    502507                        validp = true;
     508                        break;
     509                  case 'w':
     510                        for ( auto & w : WarningFormats ) {
     511                                w.severity = Severity::Suppress;
     512                        } // for
     513                        break;
     514                  case 'W':
     515                        if ( strcmp( optarg, "all" ) == 0 ) {
     516                                for ( auto & w : WarningFormats ) {
     517                                        if ( w.severity == Severity::Suppress ) w.severity = Severity::Warn;
     518                                } // for
     519                        } else if ( strcmp( optarg, "error" ) == 0 ) {
     520                                Werror = true;
     521                        } else {
     522                                char * warning = optarg;
     523                                Severity s;
     524                                if ( strncmp( optarg, "no-", 3 ) == 0 ) {
     525                                        warning += 3;
     526                                        s = Severity::Suppress;
     527                                } else {
     528                                        s = Severity::Warn;
     529                                } // if
     530                                for ( auto  & w : WarningFormats ) {
     531                                        if ( strcmp( warning, w.name ) == 0 ) { // replace the argument for cfa-cpp
     532                                                w.severity = s;
     533                                                break;
     534                                        } // if
     535                                } // for
     536                        } // if
    503537                        break;
    504538                  case 'y':                                                                             // dump AST on error
     
    530564                } // switch
    531565        } // while
     566
     567        if ( Werror ) {
     568                for ( auto & w : WarningFormats ) {
     569                        if ( w.severity == Severity::Warn ) w.severity = Severity::Error;
     570                } // for
     571        } // if
     572        // for ( const auto w : WarningFormats ) {
     573        //      cout << w.name << ' ' << (int)w.severity << endl;
     574        // } // for
    532575} // parse_cmdline
    533576
Note: See TracChangeset for help on using the changeset viewer.