Changeset 03e3117


Ignore:
Timestamp:
Sep 10, 2016, 11:04:50 AM (8 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, resolv-new, with_gc
Children:
add7117, d88f256a
Parents:
b6fe7e6 (diff), 126e54f (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:
6 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    rb6fe7e6 r03e3117  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Aug 29 22:30:56 2016
    13 // Update Count     : 327
     12// Last Modified On : Fri Sep  9 23:21:47 2016
     13// Update Count     : 402
    1414//
    1515
     
    4343extern LinkageSpec::Spec linkage;                                               // defined in parser.yy
    4444
    45 DeclarationNode::DeclarationNode()
    46                 : type( 0 )
    47                 , storageClass( NoStorageClass )
    48                 , isInline( false )
    49                 , isNoreturn( false )
    50                 , bitfieldWidth( 0 )
    51                 , initializer( 0 )
    52                 , hasEllipsis( false )
    53                 , linkage( ::linkage )
    54                 , extension( false )
    55                 , error() {
     45DeclarationNode::DeclarationNode() :
     46                type( 0 ),
     47                storageClass( NoStorageClass ),
     48                isInline( false ),
     49                isNoreturn( false ),
     50                bitfieldWidth( 0 ),
     51                initializer( 0 ),
     52                hasEllipsis( false ),
     53                linkage( ::linkage ),
     54                extension( false ) {
     55        variable.tyClass = DeclarationNode::Type;
     56        variable.assertions = nullptr;
     57
    5658        attr.expr = nullptr;
    5759        attr.type = nullptr;
    58 
    59         variable.tyClass = DeclarationNode::Type;
    60         variable.assertions = nullptr;
    6160}
    6261
     
    393392
    394393        if ( (qsrc & qdst).any() ) {                                            // common bits between qualifier masks ?
    395                 error = "duplicate qualifier ";
    396                 int j = 0;                                                                              // separator detector
    397                 for ( int i = 0; i < DeclarationNode::NoOfQualifier; i += 1 ) {
    398                         if ( qsrc[i] & qdst[i] ) {                                      // find specific qualifiers in common
    399                                 if ( j > 0 ) error += ", ";
    400                                 error += DeclarationNode::qualifierName[i];
    401                                 j += 1;
     394                for ( int i = 0; i < NoOfQualifier; i += 1 ) {  // find common qualifiers
     395                        if ( qsrc[i] & qdst[i] ) {
     396                                error += string(error.empty() ? "" : ", ") + "duplicate " + DeclarationNode::qualifierName[i];
    402397                        } // if
    403398                } // for
    404                 error += " in declaration of ";
    405399        } // if
    406400} // DeclarationNode::checkQualifiers
     
    442436                storageClass = q->storageClass;
    443437        } else if ( q->storageClass != NoStorageClass ) {
    444                 q->error = "invalid combination of storage classes in declaration of ";
    445         } // if
    446         if ( error.empty() ) error = q->error;
    447         return this;
    448 }
     438                if ( storageClass == q->storageClass ) {
     439                        q->error += string( "duplicate " ) + storageName[ storageClass ];
     440                } else {                                                                                // can only have one storage class
     441                        q->error += string( "multiple " ) + storageName[ storageClass ] + " & " + storageName[ q->storageClass ];
     442                } // if
     443        } // if
     444        if ( ! q->error.empty() ) {
     445                error += (! error.empty() ? ", " : "") + q->error;
     446        } // if
     447        return this;
     448} // DeclarationNode::copyStorageClasses
    449449
    450450static void addTypeToType( TypeData *&src, TypeData *&dst ) {
     
    908908
    909909Declaration *DeclarationNode::build() const {
    910         if ( ! error.empty() ) throw SemanticError( error, this );
     910        if ( ! error.empty() ) throw SemanticError( error + " in declaration of ", this );
    911911        if ( type ) {
    912912                if ( type->kind == TypeData::Variable ) {
     
    922922                return (new ObjectDecl( name, storageClass, linkage, maybeBuild< Expression >( bitfieldWidth ), 0, maybeBuild< Initializer >( initializer ) ))->set_extension( extension );
    923923        } // if
    924         throw SemanticError( "invalid function specifier in declaration of ", this );
     924        throw SemanticError( "invalid function specifier ", this );
    925925}
    926926
     
    971971}
    972972
    973 // DeclarationNode::StorageClass DeclarationNode::buildStorageClass() const {
    974 //      DeclarationNode::StorageClass ret = DeclarationNode::NoStorageClass;
    975 //      for ( std::list< DeclarationNode::StorageClass >::const_iterator i = storageClasses.begin(); i != storageClasses.end(); ++i ) {
    976 //        if ( *i == DeclarationNode::Inline || *i == DeclarationNode::Noreturn ) continue; // ignore function specifiers
    977 //        if ( ret != DeclarationNode::NoStorageClass ) {       // already have a valid storage class ?
    978 //                      throw SemanticError( "invalid combination of storage classes in declaration of ", this );
    979 //              } // if
    980 //              ret = *i;
    981 //      } // for
    982 //      return ret;
    983 // }
    984 
    985 // bool DeclarationNode::buildFuncSpecifier( DeclarationNode::StorageClass key ) const {
    986 //      std::list< DeclarationNode::StorageClass >::const_iterator first = std::find( storageClasses.begin(), storageClasses.end(), key );
    987 //   if ( first == storageClasses.end() ) return false; // not found
    988 //      first = std::find( ++first, storageClasses.end(), key ); // found
    989 //   if ( first == storageClasses.end() ) return true;          // not found again
    990 //      throw SemanticError( "duplicate function specifier in declaration of ", this );
    991 // }
    992 
    993973// Local Variables: //
    994974// tab-width: 4 //
  • src/Parser/ParseNode.h

    rb6fe7e6 r03e3117  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Aug 29 21:45:43 2016
    13 // Update Count     : 583
     12// Last Modified On : Thu Sep  8 21:58:06 2016
     13// Update Count     : 587
    1414//
    1515
     
    290290        // bool buildFuncSpecifier( StorageClass key ) const;
    291291
    292         struct Enumeration_t {
    293                 std::string name;
    294                 DeclarationNode * constants;
    295         };
    296         Enumeration_t enumeration;
    297 
    298292        struct Variable_t {
    299293                DeclarationNode::TypeClass tyClass;
     
    408402                        if ( result ) {
    409403                                *out++ = result;
    410                         } else {
    411404                        } // if
    412405                } catch( SemanticError &e ) {
  • src/Parser/TypeData.h

    rb6fe7e6 r03e3117  
    1010// Created On       : Sat May 16 15:18:36 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Aug 29 22:31:52 2016
    13 // Update Count     : 110
     12// Last Modified On : Fri Sep  9 23:20:55 2016
     13// Update Count     : 117
    1414//
    1515
     
    9696                Array_t array;
    9797                Enumeration_t enumeration;
     98                // Variable_t variable;
    9899                Function_t function;
    99100                Symbolic_t symbolic;
    100101                DeclarationNode * tuple;
    101102                ExpressionNode * typeexpr;
    102                 //Attr_t attr;
     103                // Attr_t attr;
    103104                // DeclarationNode::BuiltinType builtin;
    104105
  • src/tests/.expect/declarationErrors.txt

    rb6fe7e6 r03e3117  
    11CFA Version 1.0.0 (debug)
    2 Error: invalid combination of storage classes in declaration of x9: static const volatile short int
     2Error: duplicate static in declaration of x1: static const volatile short int
    33
    4 Error: invalid combination of storage classes in declaration of x18: static const volatile instance of const volatile struct __anonymous0
     4Error: multiple extern & static in declaration of x2: extern const volatile short int
     5
     6Error: multiple extern & auto, multiple extern & static, multiple extern & static, duplicate extern in declaration of x3: extern const volatile short int
     7
     8Error: duplicate static in declaration of x4: static const volatile instance of const volatile struct __anonymous0
    59  with members
    610   with body
    711
    812
    9 Error: duplicate qualifier volatile in declaration of x19: static const volatile instance of const volatile struct __anonymous1
     13Error: duplicate const, duplicate static, duplicate volatile in declaration of x5: static const volatile instance of const volatile struct __anonymous1
    1014  with members
    1115   with body
    1216
    1317
    14 Error: invalid combination of storage classes in declaration of x28: static const volatile instance of type Int
     18Error: duplicate static in declaration of x6: static const volatile instance of type Int
    1519
    16 Error: duplicate qualifier const in declaration of f01: static inline function
     20Error: duplicate const in declaration of f01: static inline function
    1721  with no parameters
    1822  returning const volatile int
    1923
    2024
    21 Error: duplicate qualifier volatile in declaration of f02: static inline function
     25Error: duplicate volatile in declaration of f02: static inline function
    2226  with no parameters
    2327  returning const volatile int
    2428
    2529
    26 Error: duplicate qualifier const in declaration of f03: static inline function
     30Error: duplicate const in declaration of f03: static inline function
    2731  with no parameters
    2832  returning const volatile int
    2933
    3034
    31 Error: duplicate qualifier volatile in declaration of f04: static inline function
     35Error: duplicate volatile in declaration of f04: static inline function
    3236  with no parameters
    3337  returning const volatile int
    3438
    3539
    36 Error: duplicate qualifier const in declaration of f05: static inline function
     40Error: duplicate const in declaration of f05: static inline function
    3741  with no parameters
    3842  returning const volatile int
    3943
    4044
    41 Error: duplicate qualifier volatile in declaration of f06: static inline function
     45Error: duplicate volatile in declaration of f06: static inline function
    4246  with no parameters
    4347  returning const volatile int
    4448
    4549
    46 Error: duplicate qualifier const in declaration of f07: static inline function
     50Error: duplicate const in declaration of f07: static inline function
    4751  with no parameters
    4852  returning const volatile int
    4953
    5054
    51 Error: duplicate qualifier const, volatile in declaration of f08: static inline function
     55Error: duplicate const, duplicate volatile in declaration of f08: static inline function
    5256  with no parameters
    5357  returning const volatile int
    5458
    5559
    56 Error: duplicate qualifier const, volatile in declaration of f09: static inline function
     60Error: duplicate const, duplicate volatile in declaration of f09: static inline function
    5761  with no parameters
    5862  returning const volatile int
    5963
    6064
    61 Error: duplicate qualifier const, volatile in declaration of f09: static inline function
     65Error: duplicate const, duplicate _Atomic, duplicate _Atomic, duplicate const, duplicate restrict, duplicate volatile in declaration of f09: static inline function
    6266  with no parameters
    63   returning const volatile int
     67  returning const restrict volatile _Atomic int
    6468
    6569
  • src/tests/declarationErrors.c

    rb6fe7e6 r03e3117  
    1010// Created On       : Wed Aug 17 08:23:43 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Aug 25 18:16:40 2016
    13 // Update Count     : 5
     12// Last Modified On : Fri Sep  9 22:57:52 2016
     13// Update Count     : 31
    1414//
    1515
    16 static short int volatile static const x9;                              // duplicate static
    17 struct { int i; } const static volatile static x18;             // duplicate static
    18 struct { int i; } const static volatile static volatile x19; // duplicate static & volatile
     16static short int volatile static const x1;                              // duplicate static
     17extern short int static volatile const x2;                              // multiple extern & static
     18extern short int auto static volatile static extern const x3; // duplicate and multiple storage classes
     19struct { int i; } const static volatile static x4;              // duplicate static
     20struct { int i; } const static volatile const static volatile x5; // duplicate static & const & volatile
    1921typedef int Int;
    20 static Int volatile static const x28;                                   // duplicate static
     22static Int volatile static const x6;                                    // duplicate static
    2123
    2224const static inline const volatile int f01();                   // duplicate const
     
    2426const inline const volatile int static f03();                   // duplicate const
    2527volatile inline static const volatile int f04();                // duplicate volatile
    26 const static const inline volatile int f05();                   // duplicate const
    27 volatile static const volatile inline int f06();                // duplicate volatile
    28 const static const volatile int inline f07();                   // duplicate const
    29 volatile static const int inline const volatile f08();          // duplicate volatile
     28const static int const inline volatile f05();                   // duplicate const
     29volatile int static const volatile inline f06();                // duplicate volatile
     30const static const int volatile inline f07();                   // duplicate const
     31volatile static const int inline const volatile f08();  // duplicate volatile
    3032
    31 volatile static const int inline const volatile f09();          // duplicate volatile
    32 volatile static const int inline const volatile f09();          // duplicate volatile
     33volatile static const int inline const volatile f09();  // duplicate volatile
     34_Atomic _Atomic _Atomic volatile restrict static const const int inline restrict const volatile f09();  // duplicate volatile
    3335
    3436//Dummy main
  • src/tests/test.py

    rb6fe7e6 r03e3117  
    285285# check if the user already passed in a number of jobs for multi-threading
    286286make_flags = environ.get('MAKEFLAGS')
    287 make_has_max_jobs = re.search("(-j|--jobs)\s*([0-9]+)", make_flags) if make_flags else None
    288 make_max_jobs = make_has_max_jobs.group(2) if make_has_max_jobs else None
    289 make_cmd = "make" if make_flags and "-j" in make_flags else "make -j8"
     287make_jobs_fds = re.search("--jobserver-fds=\s*([0-9]+),([0-9]+)", make_flags) if make_flags else None
     288if make_jobs_fds :
     289        tokens = os.read(int(make_jobs_fds.group(1)), 1024)
     290        options.jobs = len(tokens)
     291        os.write(int(make_jobs_fds.group(2)), tokens)
    290292
    291293# make sure we have a valid number of jobs that corresponds to user input
    292 options.jobs = int(make_max_jobs) if make_max_jobs else (options.jobs if options.jobs else 1)
    293294if options.jobs <= 0 :
    294295        print('ERROR: Invalid number of jobs', file=sys.stderr)
     
    296297
    297298print('Running on %i cores' % options.jobs)
     299make_cmd = "make" if make_flags else ("make -j%i" % options.jobs)
    298300
    299301# users may want to simply list the tests
Note: See TracChangeset for help on using the changeset viewer.