Changeset 9dc31c10


Ignore:
Timestamp:
Apr 19, 2018, 5:46:39 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:
c28afead
Parents:
d046db2
Message:

warning message for type qualifiers on zero_t/one_t

Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/Common/SemanticError.h

    rd046db2 r9dc31c10  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Aug 29 22:03:36 2017
    13 // Update Count     : 17
     12// Last Modified On : Wed Apr 18 16:28:16 2018
     13// Update Count     : 18
    1414//
    1515
     
    3939        "self assignment of expression: %s",
    4040        "rvalue to reference conversion of rvalue: %s",
     41        "questionable use of type qualifier %s with %s",
    4142};
    4243
     
    4445        SelfAssignment,
    4546        RvalueToReferenceConversion,
     47        BadQualifiersZeroOne,
    4648        NUMBER_OF_WARNINGS, //This MUST be the last warning
    4749};
  • src/Common/utility.h

    rd046db2 r9dc31c10  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Aug 17 11:38:00 2017
    13 // Update Count     : 34
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Apr 19 16:21:44 2018
     13// Update Count     : 37
    1414//
    1515
     
    436436}
    437437
     438// -----------------------------------------------------------------------------
     439// O(1) polymorphic integer log2, using clz, which returns the number of leading 0-bits, starting at the most
     440// significant bit (single instruction on x86)
     441
     442template<typename T>
     443inline constexpr T log2(const T & t) {
     444        if ( std::is_integral<T>::value ) {
     445                const constexpr int r = sizeof(t) * __CHAR_BIT__ - 1;
     446                if ( sizeof(T) == sizeof(unsigned int ) ) return r - __builtin_clz( t );
     447                if ( sizeof(T) == sizeof(unsigned long) ) return r - __builtin_clzl( t );
     448                if ( sizeof(T) == sizeof(unsigned long long) ) return r - __builtin_clzll( t );
     449        } // if
     450        return -1;
     451}
    438452
    439453
  • src/Parser/DeclarationNode.cc

    rd046db2 r9dc31c10  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 22 15:37:17 2018
    13 // Update Count     : 1033
     12// Last Modified On : Thu Apr 19 15:09:29 2018
     13// Update Count     : 1062
    1414//
    1515
     
    4747const char * DeclarationNode::aggregateNames[] = { "struct", "union", "trait", "coroutine", "monitor", "thread", "NoAggregateNames" };
    4848const char * DeclarationNode::typeClassNames[] = { "otype", "dtype", "ftype", "NoTypeClassNames" };
    49 const char * DeclarationNode::builtinTypeNames[] = { "__builtin_va_list", "NoBuiltinTypeNames" };
     49const char * DeclarationNode::builtinTypeNames[] = { "__builtin_va_list", "zero_t", "one_t", "NoBuiltinTypeNames" };
    5050
    5151UniqueName DeclarationNode::anonymous( "__anonymous" );
     
    561561
    562562        checkQualifiers( type, q->type );
     563        if ( (builtin == Zero || builtin == One) && error.length() == 0 ) {
     564                SemanticWarning( yylloc, Warning::BadQualifiersZeroOne, Type::QualifiersNames[log2( q->type->qualifiers.val )], builtinTypeNames[builtin] );
     565//              appendError( error, string( "questionable qualifiers" ) );
     566        } // if
    563567        addQualifiersToType( q->type, type );
    564568
  • src/Parser/TypeData.cc

    rd046db2 r9dc31c10  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 22 15:49:00 2018
    13 // Update Count     : 597
     12// Last Modified On : Tue Apr 17 23:00:52 2018
     13// Update Count     : 602
    1414//
    1515
     
    395395                break;
    396396          case Builtin:
    397                 os << "gcc builtin type";
     397                os << DeclarationNode::builtinTypeNames[builtintype];
    398398                break;
    399399          default:
Note: See TracChangeset for help on using the changeset viewer.