Changeset 2ae16219 for src


Ignore:
Timestamp:
Apr 19, 2018, 11:04:47 AM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
c28bcc7
Parents:
b2da0574 (diff), 61323a7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:/u/cforall/software/cfa/cfa-cc

Location:
src
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • src/Common/SemanticError.cc

    rb2da0574 r2ae16219  
    6868}
    6969
    70 void SemanticWarningImpl( CodeLocation location, Warning, const char * const fmt, ... ) {
    71         va_list args;
    72         va_start(args, fmt);
    73         std::string msg = fmtToString( fmt, args );
    74         va_end(args);
    75         std::cerr << ErrorHelpers::bold() << location << ErrorHelpers::warning_str() << ErrorHelpers::reset_font() << msg << std::endl;
     70void SemanticWarningImpl( CodeLocation location, Warning warning, const char * const fmt, ... ) {
     71        Severity severity = WarningFormats[(int)warning].severity;
     72        switch(severity) {
     73        case Severity::Suppress :
     74                break;
     75        case Severity::Warn :
     76                {
     77                        va_list args;
     78                        va_start(args, fmt);
     79                        std::string msg = fmtToString( fmt, args );
     80                        va_end(args);
     81                        std::cerr << ErrorHelpers::bold() << location << ErrorHelpers::warning_str() << ErrorHelpers::reset_font() << msg << std::endl;
     82                }
     83                break;
     84        case Severity::Error :
     85                {
     86                        va_list args;
     87                        va_start(args, fmt);
     88                        std::string msg = fmtToString( fmt, args );
     89                        va_end(args);
     90                        SemanticError(location, msg);
     91                }
     92                break;
     93        case Severity::Critical :
     94                assertf(false, "Critical errors not implemented yet");
     95                break;
     96        }
    7697}
    7798
  • src/Common/SemanticError.h

    rb2da0574 r2ae16219  
    3636// Warnings
    3737
    38 constexpr const char * const WarningFormats[] = {
    39         "self assignment of expression: %s",
    40         "rvalue to reference conversion of rvalue: %s",
     38enum class Severity {
     39        Suppress,
     40        Warn,
     41        Error,
     42        Critical
     43};
     44
     45struct WarningData {
     46        const char * const name;
     47        const char * const message;
     48        mutable Severity severity;
     49};
     50
     51constexpr const WarningData WarningFormats[] = {
     52        {"self-assign"         , "self assignment of expression: %s"           , Severity::Warn},
     53        {"reference-conversion", "rvalue to reference conversion of rvalue: %s", Severity::Warn},
    4154};
    4255
     
    5265);
    5366
    54 // ## used here to allow empty __VA_ARGS__
    55 #define SemanticWarning(loc, id, ...) SemanticWarningImpl(loc, id, WarningFormats[(int)id], ## __VA_ARGS__)
     67#define SemanticWarning(loc, id, ...) SemanticWarningImpl(loc, id, WarningFormats[(int)id].message, __VA_ARGS__)
    5668
    5769void SemanticWarningImpl (CodeLocation loc, Warning warn, const char * const fmt, ...) __attribute__((format(printf, 3, 4)));
  • src/Parser/parser.yy

    rb2da0574 r2ae16219  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar 28 17:52:24 2018
    13 // Update Count     : 3130
     12// Last Modified On : Tue Apr 17 17:10:30 2018
     13// Update Count     : 3144
    1414//
    1515
     
    391391%precedence '('
    392392
    393 %locations                      // support location tracking for error messages
     393%locations                                                                                              // support location tracking for error messages
    394394
    395395%start translation_unit                                                                 // parse-tree root
     
    17081708        | LONG
    17091709                { $$ = DeclarationNode::newLength( DeclarationNode::Long ); }
    1710         | ZERO_T
    1711                 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Zero ); }
    1712         | ONE_T
    1713                 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::One ); }
    17141710        | VALIST                                                                                        // GCC, __builtin_va_list
    17151711                { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); }
     
    17311727basic_type_specifier:
    17321728        direct_type
     1729                // Cannot have type modifiers, e.g., short, long, etc.
    17331730        | type_qualifier_list_opt indirect_type type_qualifier_list_opt
    17341731                { $$ = $2->addQualifiers( $1 )->addQualifiers( $3 ); }
     
    17361733
    17371734direct_type:
    1738                 // A semantic check is necessary for conflicting type qualifiers.
    17391735        basic_type_name
    17401736        | type_qualifier_list basic_type_name
     
    17551751        | ATTR_TYPEGENname '(' comma_expression ')'                     // CFA: e.g., @type(a+b) y;
    17561752                { $$ = DeclarationNode::newAttr( $1, $3 ); }
     1753        | ZERO_T                                                                                        // CFA
     1754                { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Zero ); }
     1755        | ONE_T                                                                                         // CFA
     1756                { $$ = DeclarationNode::newBuiltinType( DeclarationNode::One ); }
    17571757        ;
    17581758
  • src/libcfa/time

    rb2da0574 r2ae16219  
    1010// Created On       : Wed Mar 14 23:18:57 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Apr 13 07:51:52 2018
    13 // Update Count     : 634
     12// Last Modified On : Sat Apr 14 17:48:23 2018
     13// Update Count     : 636
    1414//
    1515
     
    2929
    3030//######################### Duration #########################
    31 
    32 static inline void ?{}( Duration & dur, Duration d ) with( dur ) { tv = d.tv; }
    3331
    3432static inline Duration ?=?( Duration & dur, zero_t ) { return dur{ 0 }; }
     
    137135//######################### Time #########################
    138136
    139 static inline void ?{}( Time & time, Time t ) with( time ) { tv = t.tv; }
    140137void ?{}( Time & time, int year, int month = 0, int day = 0, int hour = 0, int min = 0, int sec = 0, int nsec = 0 );
     138static inline Time ?=?( Time & time, zero_t ) { return time{ 0 }; }
     139
    141140static inline void ?{}( Time & time, timeval t ) with( time ) { tv = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * 1000; }
    142 
    143 static inline Time ?=?( Time & time, zero_t ) { return time{ 0 }; }
    144 
    145141static inline Time ?=?( Time & time, timeval t ) with( time ) {
    146142        tv = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * (TIMEGRAN / 1_000_000LL);
     
    148144} // ?=?
    149145
    150 static inline void ?{}( Time & time, timespec t ) with( time ) {
    151         tv = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec;
    152 } // Time
    153 
     146static inline void ?{}( Time & time, timespec t ) with( time ) { tv = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; }
    154147static inline Time ?=?( Time & time, timespec t ) with( time ) {
    155148        tv = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec;
  • src/tests/concurrent/preempt.c

    rb2da0574 r2ae16219  
    1111}
    1212
     13#ifdef LONG_TEST
     14static const unsigned long N = 30_000ul;
     15#else
     16static const unsigned long N = 500ul;
     17#endif
     18
    1319static volatile int counter = 0;
    1420
     
    2228
    2329void main(worker_t & this) {
    24         while(counter < 1000) {
     30        while(counter < N) {
    2531                if( (counter % 7) == this.value ) {
    2632                        int next = __atomic_add_fetch_4(&counter, 1, __ATOMIC_SEQ_CST);
Note: See TracChangeset for help on using the changeset viewer.