Changeset caa649b for src


Ignore:
Timestamp:
Mar 6, 2018, 12:11:11 PM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
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:
520145b, e5d4e5c, e6c5e79
Parents:
094476d (diff), 1feb535f (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:software/cfa/cfa-cc

Location:
src
Files:
2 added
2 deleted
28 edited

Legend:

Unmodified
Added
Removed
  • src/Common/PassVisitor.impl.h

    r094476d rcaa649b  
    22772277}
    22782278
    2279 
     2279//--------------------------------------------------------------------------
     2280// TupleType
    22802281template< typename pass_type >
    22812282void PassVisitor< pass_type >::visit( TupleType * node ) {
    2282         VISIT_BODY( node );
    2283 }
    2284 
     2283        VISIT_START( node );
     2284
     2285        maybeAccept_impl( node->forall, *this );
     2286        maybeAccept_impl( node->types, *this );
     2287        maybeAccept_impl( node->members, *this );
     2288
     2289        VISIT_END( node );
     2290}
     2291
     2292template< typename pass_type >
     2293Type * PassVisitor< pass_type >::mutate( TupleType * node ) {
     2294        MUTATE_START( node );
     2295
     2296        maybeMutate_impl( node->forall, *this );
     2297        maybeMutate_impl( node->types, *this );
     2298        maybeMutate_impl( node->members, *this );
     2299
     2300        MUTATE_END( Type, node );
     2301}
     2302
     2303//--------------------------------------------------------------------------
     2304// TypeofType
    22852305template< typename pass_type >
    22862306void PassVisitor< pass_type >::visit( TypeofType * node ) {
    2287         VISIT_BODY( node );
    2288 }
    2289 
     2307        VISIT_START( node );
     2308
     2309        assert( node->expr );
     2310        maybeAccept_impl( node->expr, *this );
     2311
     2312        VISIT_END( node );
     2313}
     2314
     2315template< typename pass_type >
     2316Type * PassVisitor< pass_type >::mutate( TypeofType * node ) {
     2317        MUTATE_START( node );
     2318
     2319        assert( node->expr );
     2320        maybeMutate_impl( node->expr, *this );
     2321
     2322        MUTATE_END( Type, node );
     2323}
     2324
     2325//--------------------------------------------------------------------------
     2326// AttrType
    22902327template< typename pass_type >
    22912328void PassVisitor< pass_type >::visit( AttrType * node ) {
    2292         VISIT_BODY( node );
    2293 }
    2294 
     2329        VISIT_START( node );
     2330
     2331        if ( node->isType ) {
     2332                assert( node->type );
     2333                maybeAccept_impl( node->type, *this );
     2334        } else {
     2335                assert( node->expr );
     2336                maybeAccept_impl( node->expr, *this );
     2337        } // if
     2338
     2339        VISIT_END( node );
     2340}
     2341
     2342template< typename pass_type >
     2343Type * PassVisitor< pass_type >::mutate( AttrType * node ) {
     2344        MUTATE_START( node );
     2345
     2346        if ( node->isType ) {
     2347                assert( node->type );
     2348                maybeMutate_impl( node->type, *this );
     2349        } else {
     2350                assert( node->expr );
     2351                maybeMutate_impl( node->expr, *this );
     2352        } // if
     2353
     2354        MUTATE_END( Type, node );
     2355}
     2356
     2357//--------------------------------------------------------------------------
     2358// VarArgsType
    22952359template< typename pass_type >
    22962360void PassVisitor< pass_type >::visit( VarArgsType * node ) {
    2297         VISIT_BODY( node );
    2298 }
    2299 
     2361        VISIT_START( node );
     2362
     2363        maybeAccept_impl( node->forall, *this );
     2364
     2365        VISIT_END( node );
     2366}
     2367
     2368template< typename pass_type >
     2369Type * PassVisitor< pass_type >::mutate( VarArgsType * node ) {
     2370        MUTATE_START( node );
     2371
     2372        maybeMutate_impl( node->forall, *this );
     2373
     2374        MUTATE_END( Type, node );
     2375}
     2376
     2377//--------------------------------------------------------------------------
     2378// ZeroType
    23002379template< typename pass_type >
    23012380void PassVisitor< pass_type >::visit( ZeroType * node ) {
    2302         VISIT_BODY( node );
    2303 }
    2304 
     2381        VISIT_START( node );
     2382
     2383        maybeAccept_impl( node->forall, *this );
     2384
     2385        VISIT_END( node );
     2386}
     2387
     2388template< typename pass_type >
     2389Type * PassVisitor< pass_type >::mutate( ZeroType * node ) {
     2390        MUTATE_START( node );
     2391
     2392        maybeMutate_impl( node->forall, *this );
     2393
     2394        MUTATE_END( Type, node );
     2395}
     2396
     2397//--------------------------------------------------------------------------
     2398// OneType
    23052399template< typename pass_type >
    23062400void PassVisitor< pass_type >::visit( OneType * node ) {
    2307         VISIT_BODY( node );
    2308 }
    2309 
     2401        VISIT_START( node );
     2402
     2403        maybeAccept_impl( node->forall, *this );
     2404
     2405        VISIT_END( node );
     2406}
     2407
     2408template< typename pass_type >
     2409Type * PassVisitor< pass_type >::mutate( OneType * node ) {
     2410        MUTATE_START( node );
     2411
     2412        maybeMutate_impl( node->forall, *this );
     2413
     2414        MUTATE_END( Type, node );
     2415}
     2416
     2417//--------------------------------------------------------------------------
     2418// Designation
    23102419template< typename pass_type >
    23112420void PassVisitor< pass_type >::visit( Designation * node ) {
    23122421        VISIT_START( node );
    23132422
    2314         maybeAccept_impl( node->get_designators(), *this );
     2423        maybeAccept_impl( node->designators, *this );
    23152424
    23162425        VISIT_END( node );
     
    23212430        MUTATE_START( node );
    23222431
    2323         maybeMutate_impl( node->get_designators(), *this );
     2432        maybeMutate_impl( node->designators, *this );
    23242433
    23252434        MUTATE_END( Designation, node );
     
    23322441        VISIT_START( node );
    23332442
    2334         visitExpression( node->get_value() );
     2443        visitExpression( node->value );
    23352444
    23362445        VISIT_END( node );
     
    23412450        MUTATE_START( node );
    23422451
    2343         node->set_value( mutateExpression( node->get_value() ) );
     2452        node->value = mutateExpression( node->value );
    23442453
    23452454        MUTATE_END( Initializer, node );
    23462455}
    23472456
     2457//--------------------------------------------------------------------------
     2458// ListInit
    23482459template< typename pass_type >
    23492460void PassVisitor< pass_type >::visit( ListInit * node ) {
    2350         VISIT_BODY( node );
    2351 }
    2352 
     2461        VISIT_START( node );
     2462
     2463        maybeAccept_impl( node->designations, *this );
     2464        maybeAccept_impl( node->initializers, *this );
     2465
     2466        VISIT_END( node );
     2467}
     2468
     2469template< typename pass_type >
     2470Initializer * PassVisitor< pass_type >::mutate( ListInit * node ) {
     2471        MUTATE_START( node );
     2472
     2473        maybeMutate_impl( node->designations, *this );
     2474        maybeMutate_impl( node->initializers, *this );
     2475
     2476        MUTATE_END( Initializer, node );
     2477}
     2478
     2479//--------------------------------------------------------------------------
     2480// ConstructorInit
    23532481template< typename pass_type >
    23542482void PassVisitor< pass_type >::visit( ConstructorInit * node ) {
    2355         VISIT_BODY( node );
    2356 }
    2357 
     2483        VISIT_START( node );
     2484
     2485        maybeAccept_impl( node->ctor, *this );
     2486        maybeAccept_impl( node->dtor, *this );
     2487        maybeAccept_impl( node->init, *this );
     2488
     2489        VISIT_END( node );
     2490}
     2491
     2492template< typename pass_type >
     2493Initializer * PassVisitor< pass_type >::mutate( ConstructorInit * node ) {
     2494        MUTATE_START( node );
     2495
     2496        maybeMutate_impl( node->ctor, *this );
     2497        maybeMutate_impl( node->dtor, *this );
     2498        maybeMutate_impl( node->init, *this );
     2499
     2500        MUTATE_END( Initializer, node );
     2501}
     2502
     2503//--------------------------------------------------------------------------
     2504// Subrange
    23582505template< typename pass_type >
    23592506void PassVisitor< pass_type >::visit( Subrange * node ) {
    2360         VISIT_BODY( node );
    2361 }
    2362 
     2507        VISIT_START( node );
     2508
     2509        VISIT_END( node );
     2510}
     2511
     2512template< typename pass_type >
     2513Subrange * PassVisitor< pass_type >::mutate( Subrange * node  )  {
     2514        MUTATE_START( node );
     2515
     2516        MUTATE_END( Subrange, node );
     2517}
     2518
     2519//--------------------------------------------------------------------------
     2520// Attribute
    23632521template< typename pass_type >
    23642522void PassVisitor< pass_type >::visit( Constant * node ) {
    2365         VISIT_BODY( node );
    2366 }
    2367 
     2523        VISIT_START( node );
     2524
     2525        VISIT_END( node );
     2526}
     2527
     2528template< typename pass_type >
     2529Constant * PassVisitor< pass_type >::mutate( Constant * node  )  {
     2530        MUTATE_START( node );
     2531
     2532        MUTATE_END( Constant, node );
     2533}
     2534
     2535//--------------------------------------------------------------------------
     2536// Attribute
    23682537template< typename pass_type >
    23692538void PassVisitor< pass_type >::visit( Attribute * node ) {
    2370         VISIT_BODY( node );
    2371 }
    2372 
    2373 //---------------------------------------------------------------------------------------------------------------
    2374 
    2375 template< typename pass_type >
    2376 Type * PassVisitor< pass_type >::mutate( TupleType * node ) {
    2377         MUTATE_BODY( Type, node );
    2378 }
    2379 
    2380 template< typename pass_type >
    2381 Type * PassVisitor< pass_type >::mutate( TypeofType * node ) {
    2382         MUTATE_BODY( Type, node );
    2383 }
    2384 
    2385 template< typename pass_type >
    2386 Type * PassVisitor< pass_type >::mutate( AttrType * node ) {
    2387         MUTATE_BODY( Type, node );
    2388 }
    2389 
    2390 template< typename pass_type >
    2391 Type * PassVisitor< pass_type >::mutate( VarArgsType * node ) {
    2392         MUTATE_BODY( Type, node );
    2393 }
    2394 
    2395 template< typename pass_type >
    2396 Type * PassVisitor< pass_type >::mutate( ZeroType * node ) {
    2397         MUTATE_BODY( Type, node );
    2398 }
    2399 
    2400 template< typename pass_type >
    2401 Type * PassVisitor< pass_type >::mutate( OneType * node ) {
    2402         MUTATE_BODY( Type, node );
    2403 }
    2404 
    2405 template< typename pass_type >
    2406 Initializer * PassVisitor< pass_type >::mutate( ListInit * node ) {
    2407         MUTATE_BODY( Initializer, node );
    2408 }
    2409 
    2410 template< typename pass_type >
    2411 Initializer * PassVisitor< pass_type >::mutate( ConstructorInit * node ) {
    2412         MUTATE_BODY( Initializer, node );
    2413 }
    2414 
    2415 template< typename pass_type >
    2416 Subrange * PassVisitor< pass_type >::mutate( Subrange * node  )  {
    2417         MUTATE_BODY( Subrange, node );
    2418 }
    2419 
    2420 template< typename pass_type >
    2421 Constant * PassVisitor< pass_type >::mutate( Constant * node  )  {
    2422         MUTATE_BODY( Constant, node );
     2539        VISIT_START( node );
     2540
     2541        maybeAccept_impl( node->parameters, *this );
     2542
     2543        VISIT_END( node );
    24232544}
    24242545
    24252546template< typename pass_type >
    24262547Attribute * PassVisitor< pass_type >::mutate( Attribute * node  )  {
    2427         MUTATE_BODY( Attribute, node );
    2428 }
    2429 
     2548        MUTATE_START( node );
     2549
     2550        maybeMutate_impl( node->parameters, *this );
     2551
     2552        MUTATE_END( Attribute, node );
     2553}
     2554
     2555//--------------------------------------------------------------------------
     2556// TypeSubstitution
    24302557template< typename pass_type >
    24312558TypeSubstitution * PassVisitor< pass_type >::mutate( TypeSubstitution * node ) {
  • src/Common/SemanticError.cc

    r094476d rcaa649b  
    1414//
    1515
     16#include <cstdarg>
    1617#include <cstdio>                                                                               // for fileno, stderr
    1718#include <unistd.h>                                                                             // for isatty
     
    5051}
    5152
    52 void SemanticWarningImpl( CodeLocation location, std::string msg ) {
     53namespace {
     54        // convert format string and arguments into a single string
     55        std::string fmtToString(const char * fmt, va_list ap) {
     56                int size = 128;
     57                while ( true ) {
     58                        char buf[size];
     59                        va_list args;
     60                        va_copy( args, ap );
     61                        int n = vsnprintf(&buf[0], size, fmt, args);
     62                        va_end( args );
     63                        if ( n < size && n >= 0 ) return buf;
     64                        size *= 2;
     65                }
     66                assert( false );
     67        }
     68}
     69
     70void 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);
    5375        std::cerr << ErrorHelpers::bold() << location << ErrorHelpers::warning_str() << ErrorHelpers::reset_font() << msg << std::endl;
    5476}
  • src/Common/SemanticError.h

    r094476d rcaa649b  
    3737
    3838constexpr const char * const WarningFormats[] = {
    39 
     39        "self assignment of expression: %s",
    4040};
    4141
    4242enum class Warning {
     43        SelfAssignment,
    4344        NUMBER_OF_WARNINGS, //This MUST be the last warning
    4445};
     
    4950);
    5051
    51 #define SemanticWarning(loc, id, ...) SemanticWarningImpl(loc, id, WarningFormats[id], __VA_ARGS__)
     52#define SemanticWarning(loc, id, ...) SemanticWarningImpl(loc, id, WarningFormats[(int)id], __VA_ARGS__)
    5253
    5354void SemanticWarningImpl (CodeLocation loc, Warning warn, const char * const fmt, ...) __attribute__((format(printf, 3, 4)));
     
    7172}
    7273
    73 
    74 
    75 
    7674// Local Variables: //
    7775// tab-width: 4 //
  • src/Common/utility.h

    r094476d rcaa649b  
    162162}
    163163
     164#define toCString( ... ) toString( __VA_ARGS__ ).c_str()
     165
    164166// replace element of list with all elements of another list
    165167template< typename T >
  • src/GenPoly/Specialize.cc

    r094476d rcaa649b  
    200200        }
    201201
    202         struct EnvTrimmer {
    203                 TypeSubstitution * env, * newEnv;
    204                 EnvTrimmer( TypeSubstitution * env, TypeSubstitution * newEnv ) : env( env ), newEnv( newEnv ){}
    205                 void previsit( TypeDecl * tyDecl ) {
    206                         // transfer known bindings for seen type variables
    207                         if ( Type * t = env->lookup( tyDecl->name ) ) {
    208                                 newEnv->add( tyDecl->name, t );
    209                         }
    210                 }
    211         };
    212 
    213         /// reduce environment to just the parts that are referenced in a given expression
    214         TypeSubstitution * trimEnv( ApplicationExpr * expr, TypeSubstitution * env ) {
    215                 if ( env ) {
    216                         TypeSubstitution * newEnv = new TypeSubstitution();
    217                         PassVisitor<EnvTrimmer> trimmer( env, newEnv );
    218                         expr->accept( trimmer );
    219                         return newEnv;
    220                 }
    221                 return nullptr;
    222         }
    223 
    224202        /// Generates a thunk that calls `actual` with type `funType` and returns its address
    225203        Expression * Specialize::createThunkFunction( FunctionType *funType, Expression *actual, InferredParams *inferParams ) {
     
    265243                }
    266244
    267                 appExpr->set_env( trimEnv( appExpr, env ) );
     245                appExpr->env = TypeSubstitution::newFromExpr( appExpr, env );
    268246                if ( inferParams ) {
    269247                        appExpr->get_inferParams() = *inferParams;
  • src/InitTweak/FixInit.cc

    r094476d rcaa649b  
    6868                typedef std::unordered_map< int, int > UnqCount;
    6969
     70                struct SelfAssignChecker {
     71                        void previsit( ApplicationExpr * appExpr );
     72                };
     73
    7074                struct InsertImplicitCalls : public WithTypeSubstitution {
    7175                        /// wrap function application expressions as ImplicitCopyCtorExpr nodes so that it is easy to identify which
     
    183187                };
    184188
    185                 class FixCopyCtors final : public WithStmtsToAdd, public WithShortCircuiting, public WithVisitorRef<FixCopyCtors> {
     189                class FixCopyCtors final : public WithStmtsToAdd, public WithShortCircuiting, public WithVisitorRef<FixCopyCtors>, public WithTypeSubstitution {
    186190                  public:
    187191                        FixCopyCtors( UnqCount & unqCount ) : unqCount( unqCount ){}
     
    235239
    236240        void fix( std::list< Declaration * > & translationUnit, const std::string & filename, bool inLibrary ) {
     241                PassVisitor<SelfAssignChecker> checker;
     242                acceptAll( translationUnit, checker );
     243
    237244                // fixes ConstructorInit for global variables. should happen before fixInitializers.
    238245                InitTweak::fixGlobalInit( translationUnit, filename, inLibrary );
     
    311318                }
    312319
     320                namespace {
     321                        // Relatively simple structural comparison for expressions, needed to determine
     322                        // if two expressions are "the same" (used to determine if self assignment occurs)
     323                        struct StructuralChecker {
     324                                Expression * stripCasts( Expression * expr ) {
     325                                        // this might be too permissive. It's possible that only particular casts are relevant.
     326                                        while ( CastExpr * cast = dynamic_cast< CastExpr * >( expr ) ) {
     327                                                expr = cast->arg;
     328                                        }
     329                                        return expr;
     330                                }
     331
     332                                void previsit( Expression * ) {
     333                                        // anything else does not qualify
     334                                        isSimilar = false;
     335                                }
     336
     337                                template<typename T>
     338                                T * cast( Expression * node ) {
     339                                        // all expressions need to ignore casts, so this bit has been factored out
     340                                        return dynamic_cast< T * >( stripCasts( node ) );
     341                                }
     342
     343                                // ignore casts
     344                                void previsit( CastExpr * ) {}
     345
     346                                void previsit( MemberExpr * memExpr ) {
     347                                        if ( MemberExpr * otherMember = cast< MemberExpr >( other ) ) {
     348                                                if ( otherMember->member == memExpr->member ) {
     349                                                        other = otherMember->aggregate;
     350                                                        return;
     351                                                }
     352                                        }
     353                                        isSimilar = false;
     354                                }
     355
     356                                void previsit( VariableExpr * varExpr ) {
     357                                        if ( VariableExpr * otherVar = cast< VariableExpr >( other ) ) {
     358                                                if ( otherVar->var == varExpr->var ) {
     359                                                        return;
     360                                                }
     361                                        }
     362                                        isSimilar = false;
     363                                }
     364
     365                                void previsit( AddressExpr * ) {
     366                                        if ( AddressExpr * addrExpr = cast< AddressExpr >( other ) ) {
     367                                                other = addrExpr->arg;
     368                                                return;
     369                                        }
     370                                        isSimilar = false;
     371                                }
     372
     373                                Expression * other = nullptr;
     374                                bool isSimilar = true;
     375                        };
     376
     377                        bool structurallySimilar( Expression * e1, Expression * e2 ) {
     378                                PassVisitor<StructuralChecker> checker;
     379                                checker.pass.other = e2;
     380                                e1->accept( checker );
     381                                return checker.pass.isSimilar;
     382                        }
     383                }
     384
     385                void SelfAssignChecker::previsit( ApplicationExpr * appExpr ) {
     386                        DeclarationWithType * function = getFunction( appExpr );
     387                        if ( isAssignment( function ) ) {
     388                                if ( appExpr->args.size() == 2 ) {
     389                                        // check for structural similarity (same variable use, ignore casts, etc. - but does not look too deeply, anything looking like a function is off limits)
     390                                        if ( structurallySimilar( appExpr->args.front(), appExpr->args.back() ) ) {
     391                                                SemanticWarning( appExpr->location, Warning::SelfAssignment, toCString( appExpr->args.front() ) );
     392                                        }
     393                                }
     394                        }
     395                }
     396
    313397                Expression * InsertImplicitCalls::postmutate( ApplicationExpr * appExpr ) {
    314398                        if ( VariableExpr * function = dynamic_cast< VariableExpr * > ( appExpr->get_function() ) ) {
     
    364448                        ResolvExpr::findVoidExpression( resolved, indexer );
    365449                        assert( resolved );
    366                         if ( resolved->get_env() ) {
     450                        if ( resolved->env ) {
    367451                                // Extract useful information and discard new environments. Keeping them causes problems in PolyMutator passes.
    368                                 env->add( *resolved->get_env() );
    369                                 delete resolved->get_env();
    370                                 resolved->set_env( nullptr );
     452                                env->add( *resolved->env );
     453                                delete resolved->env;
     454                                resolved->env = nullptr;
    371455                        } // if
    372456                        delete stmt;
     
    550634                        // add destructors after current statement
    551635                        for ( Expression * dtor : dtors ) {
     636                                // take relevant bindings from environment
     637                                assert( ! dtor->env );
     638                                dtor->env =  maybeClone( env );
    552639                                stmtsToAddAfter.push_back( new ExprStmt( dtor ) );
    553640                        } // for
  • src/Makefile.in

    r094476d rcaa649b  
    247247        SynTree/driver_cfa_cpp-TypeDecl.$(OBJEXT) \
    248248        SynTree/driver_cfa_cpp-Initializer.$(OBJEXT) \
    249         SynTree/driver_cfa_cpp-Visitor.$(OBJEXT) \
    250         SynTree/driver_cfa_cpp-Mutator.$(OBJEXT) \
    251249        SynTree/driver_cfa_cpp-TypeSubstitution.$(OBJEXT) \
    252250        SynTree/driver_cfa_cpp-Attribute.$(OBJEXT) \
     
    527525        SynTree/FunctionDecl.cc SynTree/AggregateDecl.cc \
    528526        SynTree/NamedTypeDecl.cc SynTree/TypeDecl.cc \
    529         SynTree/Initializer.cc SynTree/Visitor.cc SynTree/Mutator.cc \
    530         SynTree/TypeSubstitution.cc SynTree/Attribute.cc \
    531         SynTree/VarExprReplacer.cc Tuples/TupleAssignment.cc \
    532         Tuples/TupleExpansion.cc Tuples/Explode.cc \
    533         Virtual/ExpandCasts.cc
     527        SynTree/Initializer.cc SynTree/TypeSubstitution.cc \
     528        SynTree/Attribute.cc SynTree/VarExprReplacer.cc \
     529        Tuples/TupleAssignment.cc Tuples/TupleExpansion.cc \
     530        Tuples/Explode.cc Virtual/ExpandCasts.cc
    534531MAINTAINERCLEANFILES = Parser/parser.output ${libdir}/${notdir \
    535532        ${cfa_cpplib_PROGRAMS}}
     
    911908SynTree/driver_cfa_cpp-Initializer.$(OBJEXT): SynTree/$(am__dirstamp) \
    912909        SynTree/$(DEPDIR)/$(am__dirstamp)
    913 SynTree/driver_cfa_cpp-Visitor.$(OBJEXT): SynTree/$(am__dirstamp) \
    914         SynTree/$(DEPDIR)/$(am__dirstamp)
    915 SynTree/driver_cfa_cpp-Mutator.$(OBJEXT): SynTree/$(am__dirstamp) \
    916         SynTree/$(DEPDIR)/$(am__dirstamp)
    917910SynTree/driver_cfa_cpp-TypeSubstitution.$(OBJEXT):  \
    918911        SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)
     
    10531046@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-FunctionType.Po@am__quote@
    10541047@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Initializer.Po@am__quote@
    1055 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Mutator.Po@am__quote@
    10561048@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-NamedTypeDecl.Po@am__quote@
    10571049@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-ObjectDecl.Po@am__quote@
     
    10691061@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-VarArgsType.Po@am__quote@
    10701062@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Po@am__quote@
    1071 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Po@am__quote@
    10721063@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-VoidType.Po@am__quote@
    10731064@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Po@am__quote@
     
    24782469@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    24792470@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Initializer.obj `if test -f 'SynTree/Initializer.cc'; then $(CYGPATH_W) 'SynTree/Initializer.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Initializer.cc'; fi`
    2480 
    2481 SynTree/driver_cfa_cpp-Visitor.o: SynTree/Visitor.cc
    2482 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Visitor.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Tpo -c -o SynTree/driver_cfa_cpp-Visitor.o `test -f 'SynTree/Visitor.cc' || echo '$(srcdir)/'`SynTree/Visitor.cc
    2483 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Po
    2484 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Visitor.cc' object='SynTree/driver_cfa_cpp-Visitor.o' libtool=no @AMDEPBACKSLASH@
    2485 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2486 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Visitor.o `test -f 'SynTree/Visitor.cc' || echo '$(srcdir)/'`SynTree/Visitor.cc
    2487 
    2488 SynTree/driver_cfa_cpp-Visitor.obj: SynTree/Visitor.cc
    2489 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Visitor.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Tpo -c -o SynTree/driver_cfa_cpp-Visitor.obj `if test -f 'SynTree/Visitor.cc'; then $(CYGPATH_W) 'SynTree/Visitor.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Visitor.cc'; fi`
    2490 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Po
    2491 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Visitor.cc' object='SynTree/driver_cfa_cpp-Visitor.obj' libtool=no @AMDEPBACKSLASH@
    2492 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2493 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Visitor.obj `if test -f 'SynTree/Visitor.cc'; then $(CYGPATH_W) 'SynTree/Visitor.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Visitor.cc'; fi`
    2494 
    2495 SynTree/driver_cfa_cpp-Mutator.o: SynTree/Mutator.cc
    2496 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Mutator.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Mutator.Tpo -c -o SynTree/driver_cfa_cpp-Mutator.o `test -f 'SynTree/Mutator.cc' || echo '$(srcdir)/'`SynTree/Mutator.cc
    2497 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Mutator.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Mutator.Po
    2498 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Mutator.cc' object='SynTree/driver_cfa_cpp-Mutator.o' libtool=no @AMDEPBACKSLASH@
    2499 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2500 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Mutator.o `test -f 'SynTree/Mutator.cc' || echo '$(srcdir)/'`SynTree/Mutator.cc
    2501 
    2502 SynTree/driver_cfa_cpp-Mutator.obj: SynTree/Mutator.cc
    2503 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Mutator.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Mutator.Tpo -c -o SynTree/driver_cfa_cpp-Mutator.obj `if test -f 'SynTree/Mutator.cc'; then $(CYGPATH_W) 'SynTree/Mutator.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Mutator.cc'; fi`
    2504 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Mutator.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Mutator.Po
    2505 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Mutator.cc' object='SynTree/driver_cfa_cpp-Mutator.obj' libtool=no @AMDEPBACKSLASH@
    2506 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2507 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Mutator.obj `if test -f 'SynTree/Mutator.cc'; then $(CYGPATH_W) 'SynTree/Mutator.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Mutator.cc'; fi`
    25082471
    25092472SynTree/driver_cfa_cpp-TypeSubstitution.o: SynTree/TypeSubstitution.cc
  • src/Parser/ExpressionNode.cc

    r094476d rcaa649b  
    1010// Created On       : Sat May 16 13:17:07 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Sep 27 22:51:55 2017
    13 // Update Count     : 781
     12// Last Modified On : Sat Mar  3 18:22:33 2018
     13// Update Count     : 796
    1414//
    1515
     
    5858static inline bool checkD( char c ) { return c == 'd' || c == 'D'; }
    5959static inline bool checkI( char c ) { return c == 'i' || c == 'I'; }
     60static inline bool checkB( char c ) { return c == 'b' || c == 'B'; }
    6061static inline bool checkX( char c ) { return c == 'x' || c == 'X'; }
    6162
     
    116117
    117118        unsigned long long int v;                                                       // converted integral value
    118         size_t last = str.length() - 1;                                         // last character of constant
     119        size_t last = str.length() - 1;                                         // last subscript of constant
    119120        Expression * ret;
    120121
     
    129130        } // if
    130131
    131         if ( str[0] == '0' ) {                                                          // octal/hex constant ?
     132        // Cannot be "0"
     133
     134        if ( str[0] == '0' ) {                                                          // radix character ?
    132135                dec = false;
    133                 if ( last != 0 && checkX( str[1] ) ) {                  // hex constant ?
     136                if ( checkX( str[1] ) ) {                                               // hex constant ?
    134137                        sscanf( (char *)str.c_str(), "%llx", &v );
     138                        //printf( "%llx %llu\n", v, v );
     139                } else if ( checkB( str[1] ) ) {                                // binary constant ?
     140                        v = 0;
     141                        for ( unsigned int i = 2;; i += 1 ) {           // compute value
     142                                if ( str[i] == '1' ) v |= 1;
     143                          if ( i == last ) break;
     144                                v <<= 1;
     145                        } // for
    135146                        //printf( "%llx %llu\n", v, v );
    136147                } else {                                                                                // octal constant
  • src/Parser/lex.ll

    r094476d rcaa649b  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Thu Feb 22 18:11:27 2018
    13  * Update Count     : 637
     12 * Last Modified On : Sat Mar  3 18:38:16 2018
     13 * Update Count     : 640
    1414 */
    1515
     
    7777%}
    7878
     79binary [0-1]
    7980octal [0-7]
    8081nonzero [1-9]
     
    103104nonzero_digits ({nonzero})|({nonzero}({decimal}|"_")*{decimal})
    104105decimal_constant {nonzero_digits}{integer_suffix_opt}
     106
     107binary_digits ({binary})|({binary}({binary}|"_")*{binary})
     108binary_prefix "0"[bB]"_"?
     109binary_constant {binary_prefix}{binary_digits}{integer_suffix_opt}
    105110
    106111hex_digits ({hex})|({hex}({hex}|"_")*{hex})
     
    315320
    316321                                /* numeric constants */
     322{binary_constant} { NUMERIC_RETURN(INTEGERconstant); }
     323{octal_constant} { NUMERIC_RETURN(INTEGERconstant); }
    317324{decimal_constant} { NUMERIC_RETURN(INTEGERconstant); }
    318 {octal_constant} { NUMERIC_RETURN(INTEGERconstant); }
    319325{hex_constant}  { NUMERIC_RETURN(INTEGERconstant); }
    320326{floating_decimal}      { NUMERIC_RETURN(FLOATING_DECIMALconstant); } // must appear before floating_constant
  • src/ResolvExpr/Resolver.cc

    r094476d rcaa649b  
    788788                stmtExpr->accept( resolver );
    789789                stmtExpr->computeResult();
     790                // xxx - aggregate the environments from all statements? Possibly in AlternativeFinder instead?
    790791        }
    791792
     
    793794                visit_children = false;
    794795                // xxx - fallback init has been removed => remove fallbackInit function and remove complexity from FixInit and remove C-init from ConstructorInit
    795                 maybeAccept( ctorInit->get_ctor(), *visitor );
    796                 maybeAccept( ctorInit->get_dtor(), *visitor );
     796                maybeAccept( ctorInit->ctor, *visitor );
     797                maybeAccept( ctorInit->dtor, *visitor );
    797798
    798799                // found a constructor - can get rid of C-style initializer
    799                 delete ctorInit->get_init();
    800                 ctorInit->set_init( NULL );
     800                delete ctorInit->init;
     801                ctorInit->init = nullptr;
    801802
    802803                // intrinsic single parameter constructors and destructors do nothing. Since this was
    803804                // implicitly generated, there's no way for it to have side effects, so get rid of it
    804805                // to clean up generated code.
    805                 if ( InitTweak::isIntrinsicSingleArgCallStmt( ctorInit->get_ctor() ) ) {
    806                         delete ctorInit->get_ctor();
    807                         ctorInit->set_ctor( NULL );
    808                 }
    809 
    810                 if ( InitTweak::isIntrinsicSingleArgCallStmt( ctorInit->get_dtor() ) ) {
    811                         delete ctorInit->get_dtor();
    812                         ctorInit->set_dtor( NULL );
     806                if ( InitTweak::isIntrinsicSingleArgCallStmt( ctorInit->ctor ) ) {
     807                        delete ctorInit->ctor;
     808                        ctorInit->ctor = nullptr;
     809                }
     810
     811                if ( InitTweak::isIntrinsicSingleArgCallStmt( ctorInit->dtor ) ) {
     812                        delete ctorInit->dtor;
     813                        ctorInit->dtor = nullptr;
    813814                }
    814815
  • src/ResolvExpr/TypeEnvironment.cc

    r094476d rcaa649b  
    118118                        env.push_back( newClass );
    119119                } // for
     120        }
     121
     122        void TypeEnvironment::add( const TypeSubstitution & sub ) {
     123                EqvClass newClass;
     124                for ( auto p : sub ) {
     125                        newClass.vars.insert( p.first );
     126                        newClass.type = p.second->clone();
     127                        newClass.allowWidening = false;
     128                        // Minimal assumptions. Not technically correct, but might be good enough, and
     129                        // is the best we can do at the moment since information is lost in the
     130                        // transition to TypeSubstitution
     131                        newClass.data = TypeDecl::Data{ TypeDecl::Dtype, false };
     132                        add( newClass );
     133                }
    120134        }
    121135
  • src/ResolvExpr/TypeEnvironment.h

    r094476d rcaa649b  
    7676                void add( const EqvClass &eqvClass );
    7777                void add( const Type::ForallList &tyDecls );
     78                void add( const TypeSubstitution & sub );
    7879                template< typename SynTreeClass > int apply( SynTreeClass *&type ) const;
    7980                template< typename SynTreeClass > int applyFree( SynTreeClass *&type ) const;
  • src/SynTree/Mutator.h

    r094476d rcaa649b  
    2222class Mutator {
    2323  protected:
    24         Mutator();
    25         virtual ~Mutator();
     24        Mutator() = default;
     25        virtual ~Mutator() = default;
    2626  public:
    2727        virtual DeclarationWithType * mutate( ObjectDecl * objectDecl ) = 0;
  • src/SynTree/TypeSubstitution.cc

    r094476d rcaa649b  
    104104bool TypeSubstitution::empty() const {
    105105        return typeEnv.empty() && varEnv.empty();
     106}
     107
     108namespace {
     109        struct EnvTrimmer {
     110                TypeSubstitution * env, * newEnv;
     111                EnvTrimmer( TypeSubstitution * env, TypeSubstitution * newEnv ) : env( env ), newEnv( newEnv ){}
     112                void previsit( TypeDecl * tyDecl ) {
     113                        // transfer known bindings for seen type variables
     114                        if ( Type * t = env->lookup( tyDecl->name ) ) {
     115                                newEnv->add( tyDecl->name, t );
     116                        }
     117                }
     118        };
     119} // namespace
     120
     121/// reduce environment to just the parts that are referenced in a given expression
     122TypeSubstitution * TypeSubstitution::newFromExpr( Expression * expr, TypeSubstitution * env ) {
     123        if ( env ) {
     124                TypeSubstitution * newEnv = new TypeSubstitution();
     125                PassVisitor<EnvTrimmer> trimmer( env, newEnv );
     126                expr->accept( trimmer );
     127                return newEnv;
     128        }
     129        return nullptr;
    106130}
    107131
  • src/SynTree/TypeSubstitution.h

    r094476d rcaa649b  
    5555        void extract( TypeInstListIterator begin, TypeInstListIterator end, TypeSubstitution &result );
    5656
     57        /// create a new TypeSubstitution using bindings from env containing all of the type variables in expr
     58        static TypeSubstitution * newFromExpr( Expression * expr, TypeSubstitution * env );
     59
    5760        void normalize();
    5861
     
    7982        TypeEnvType typeEnv;
    8083        VarEnvType varEnv;
     84
     85  public:
     86        // has to come after declaration of typeEnv
     87        auto begin()       -> decltype( typeEnv.begin() ) { return typeEnv.begin(); }
     88        auto   end()       -> decltype( typeEnv.  end() ) { return typeEnv.  end(); }
     89        auto begin() const -> decltype( typeEnv.begin() ) { return typeEnv.begin(); }
     90        auto   end() const -> decltype( typeEnv.  end() ) { return typeEnv.  end(); }
    8191};
    8292
  • src/SynTree/Visitor.h

    r094476d rcaa649b  
    2121class Visitor {
    2222  protected:
    23         Visitor();
    24         virtual ~Visitor();
     23        Visitor() = default;
     24        virtual ~Visitor() = default;
    2525  public:
    2626        // visit: Default implementation of all functions visits the children
  • src/SynTree/module.mk

    r094476d rcaa649b  
    4646       SynTree/TypeDecl.cc \
    4747       SynTree/Initializer.cc \
    48        SynTree/Visitor.cc \
    49        SynTree/Mutator.cc \
    5048       SynTree/TypeSubstitution.cc \
    5149       SynTree/Attribute.cc \
  • src/Tuples/TupleAssignment.cc

    r094476d rcaa649b  
    281281        }
    282282
    283         // removes environments from subexpressions within statement exprs, which could throw off later passes like those in Box which rely on PolyMutator.
     283        // removes environments from subexpressions within statement exprs, which could throw off later passes like those in Box which rely on PolyMutator, and adds the bindings to the compositeEnv
    284284        // xxx - maybe this should happen in alternative finder for every StmtExpr?
    285         // xxx - it's possible that these environments could contain some useful information. Maybe the right thing to do is aggregate the environments and pass the aggregate back to be added into the compositeEnv
    286285        struct EnvRemover {
    287286                void previsit( ExprStmt * stmt ) {
    288                         delete stmt->expr->env;
    289                         stmt->expr->env = nullptr;
    290                 }
     287                        assert( compositeEnv );
     288                        if ( stmt->expr->env ) {
     289                                compositeEnv->add( *stmt->expr->env );
     290                                delete stmt->expr->env;
     291                                stmt->expr->env = nullptr;
     292                        }
     293                }
     294
     295                ResolvExpr::TypeEnvironment * compositeEnv = nullptr;
    291296        };
    292297
     
    300305                        ResolvExpr::resolveCtorInit( ctorInit, spotter.currentFinder.get_indexer() ); // resolve ctor/dtors for the new object
    301306                        PassVisitor<EnvRemover> rm; // remove environments from subexpressions of StmtExprs
     307                        rm.pass.compositeEnv = &compositeEnv;
    302308                        ctorInit->accept( rm );
    303309                }
  • src/libcfa/limits

    r094476d rcaa649b  
    1010// Created On       : Wed Apr  6 18:06:52 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul  7 09:33:57 2017
    13 // Update Count     : 7
     12// Last Modified On : Thu Mar  1 16:20:54 2018
     13// Update Count     : 13
    1414//
    1515
     
    1818// Integral Constants
    1919
     20extern const signed char MIN;
     21extern const unsigned char MIN;
    2022extern const short int MIN;
     23extern const unsigned short int MIN;
    2124extern const int MIN;
     25extern const unsigned int MIN;
    2226extern const long int MIN;
     27extern const unsigned long int MIN;
    2328extern const long long int MIN;
     29extern const unsigned long long int MIN;
    2430
     31extern const signed char MAX;
     32extern const unsigned char MAX;
    2533extern const short int MAX;
    2634extern const unsigned short int MAX;
     
    3341
    3442// Floating-Point Constants
     43
     44extern const float MIN;
     45extern const double MIN;
     46extern const long double MIN;
     47extern const float _Complex MIN;
     48extern const double _Complex MIN;
     49extern const long double _Complex MIN;
     50
     51extern const float MAX;
     52extern const double MAX;
     53extern const long double MAX;
     54extern const float _Complex MAX;
     55extern const double _Complex MAX;
     56extern const long double _Complex MAX;
    3557
    3658extern const float PI;                                                                  // pi
     
    5577extern const long double _2_SQRT_PI;                                    // 2 / sqrt(pi)
    5678
    57 extern const _Complex PI;                                                               // pi
    58 extern const _Complex PI_2;                                                             // pi / 2
    59 extern const _Complex PI_4;                                                             // pi / 4
    60 extern const _Complex _1_PI;                                                    // 1 / pi
    61 extern const _Complex _2_PI;                                                    // 2 / pi
    62 extern const _Complex _2_SQRT_PI;                                               // 2 / sqrt(pi)
     79extern const float _Complex PI;                                                 // pi
     80extern const float _Complex PI_2;                                               // pi / 2
     81extern const float _Complex PI_4;                                               // pi / 4
     82extern const float _Complex _1_PI;                                              // 1 / pi
     83extern const float _Complex _2_PI;                                              // 2 / pi
     84extern const float _Complex _2_SQRT_PI;                                 // 2 / sqrt(pi)
    6385
    64 extern const long _Complex PI;                                                  // pi
    65 extern const long _Complex PI_2;                                                // pi / 2
    66 extern const long _Complex PI_4;                                                // pi / 4
    67 extern const long _Complex _1_PI;                                               // 1 / pi
    68 extern const long _Complex _2_PI;                                               // 2 / pi
    69 extern const long _Complex _2_SQRT_PI;                                  // 2 / sqrt(pi)
     86extern const double _Complex PI;                                                // pi
     87extern const double _Complex PI_2;                                              // pi / 2
     88extern const double _Complex PI_4;                                              // pi / 4
     89extern const double _Complex _1_PI;                                             // 1 / pi
     90extern const double _Complex _2_PI;                                             // 2 / pi
     91extern const double _Complex _2_SQRT_PI;                                // 2 / sqrt(pi)
     92
     93extern const long double _Complex PI;                                   // pi
     94extern const long double _Complex PI_2;                                 // pi / 2
     95extern const long double _Complex PI_4;                                 // pi / 4
     96extern const long double _Complex _1_PI;                                // 1 / pi
     97extern const long double _Complex _2_PI;                                // 2 / pi
     98extern const long double _Complex _2_SQRT_PI;                   // 2 / sqrt(pi)
    7099
    71100extern const float E;                                                                   // e
     
    93122extern const long double _1_SQRT_2;                                             // 1/sqrt(2)
    94123
    95 extern const _Complex E;                                                                // e
    96 extern const _Complex LOG2_E;                                                   // log_2(e)
    97 extern const _Complex LOG10_E;                                                  // log_10(e)
    98 extern const _Complex LN_2;                                                             // log_e(2)
    99 extern const _Complex LN_10;                                                    // log_e(10)
    100 extern const _Complex SQRT_2;                                                   // sqrt(2)
    101 extern const _Complex _1_SQRT_2;                                                // 1 / sqrt(2)
     124extern const float _Complex E;                                                  // e
     125extern const float _Complex LOG2_E;                                             // log_2(e)
     126extern const float _Complex LOG10_E;                                    // log_10(e)
     127extern const float _Complex LN_2;                                               // log_e(2)
     128extern const float _Complex LN_10;                                              // log_e(10)
     129extern const float _Complex SQRT_2;                                             // sqrt(2)
     130extern const float _Complex _1_SQRT_2;                                  // 1 / sqrt(2)
    102131
    103 extern const long _Complex E;                                                   // e
    104 extern const long _Complex LOG2_E;                                              // log_2(e)
    105 extern const long _Complex LOG10_E;                                             // log_10(e)
    106 extern const long _Complex LN_2;                                                // log_e(2)
    107 extern const long _Complex LN_10;                                               // log_e(10)
    108 extern const long _Complex SQRT_2;                                              // sqrt(2)
    109 extern const long _Complex _1_SQRT_2;                                   // 1 / sqrt(2)
     132extern const double _Complex E;                                                 // e
     133extern const double _Complex LOG2_E;                                    // log_2(e)
     134extern const double _Complex LOG10_E;                                   // log_10(e)
     135extern const double _Complex LN_2;                                              // log_e(2)
     136extern const double _Complex LN_10;                                             // log_e(10)
     137extern const double _Complex SQRT_2;                                    // sqrt(2)
     138extern const double _Complex _1_SQRT_2;                                 // 1 / sqrt(2)
     139
     140extern const long double _Complex E;                                    // e
     141extern const long double _Complex LOG2_E;                               // log_2(e)
     142extern const long double _Complex LOG10_E;                              // log_10(e)
     143extern const long double _Complex LN_2;                                 // log_e(2)
     144extern const long double _Complex LN_10;                                // log_e(10)
     145extern const long double _Complex SQRT_2;                               // sqrt(2)
     146extern const long double _Complex _1_SQRT_2;                    // 1 / sqrt(2)
    110147
    111148// Local Variables: //
  • src/libcfa/limits.c

    r094476d rcaa649b  
    1010// Created On       : Wed Apr  6 18:06:52 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 12 10:34:48 2016
    13 // Update Count     : 17
     12// Last Modified On : Thu Mar  1 16:22:51 2018
     13// Update Count     : 74
    1414//
    1515
     16#include <limits.h>
     17#include <float.h>
     18#define __USE_GNU                                                                               // get M_* constants
     19#include <math.h>
     20#include <complex.h>
    1621#include "limits"
    1722
    1823// Integral Constants
    1924
    20 const short int MIN = -32768;
    21 const int MIN = -2147483648;
    22 #if __WORDSIZE == 64
    23 const long int MIN = -9223372036854775807L - 1L;
    24 #else
    25 const long int MIN = (int)MIN;
    26 #endif // M64
    27 const long long int MIN = -9223372036854775807LL - 1LL;
     25const signed char MIN = SCHAR_MIN;
     26const unsigned char MIN = 0;
     27const short int MIN = SHRT_MIN;
     28const unsigned short int MIN = 0;
     29const int MIN = INT_MIN;
     30const unsigned int MIN = 0;
     31const long int MIN = LONG_MIN;
     32const unsigned long int MIN = 0;
     33const long long int MIN = LLONG_MIN;
     34const unsigned long long int MIN = 0;
    2835
    29 const short int MAX = 32767;
    30 const unsigned short int MAX = 65535;
    31 const int MAX = 2147483647;
    32 const unsigned int MAX = 4294967295_U;
    33 #if __WORDSIZE == 64
    34 const long int MAX = 9223372036854775807_L;
    35 #else
    36 const long int MAX = (int)MAX;
    37 #endif // M64
    38 const unsigned long int MAX = 4294967295_U;
    39 const long long int MAX = 9223372036854775807_LL;
    40 const unsigned long long int MAX = 18446744073709551615_ULL;
     36const signed char MAX = SCHAR_MAX;
     37const unsigned char MAX = UCHAR_MAX;
     38const short int MAX = SHRT_MAX;
     39const unsigned short int MAX = USHRT_MAX;
     40const int MAX = INT_MAX;
     41const unsigned int MAX = UINT_MAX;
     42const long int MAX = LONG_MAX;
     43const unsigned long int MAX = ULONG_MAX;
     44const long long int MAX = LLONG_MAX;
     45const unsigned long long int MAX = ULLONG_MAX;
    4146
    4247// Floating-Point Constants
    4348
    44 const float PI = 3.141592_F;                                                    // pi
    45 const float PI_2 = 1.570796_F;                                                  // pi / 2
    46 const float PI_4 = 0.7853981_F;                                                 // pi / 4
    47 const float _1_PI = 0.3183098_F;                                                // 1 / pi
    48 const float _2_PI = 0.6366197_F;                                                // 2 / pi
    49 const float _2_SQRT_PI = 1.128379_F;                                    // 2 / sqrt(pi)
     49const float MIN = FLT_MIN;
     50const double MIN = DBL_MIN;
     51const long double MIN = LDBL_MIN;
     52const float _Complex MIN = __FLT_MIN__ + __FLT_MIN__ * I;
     53const double _Complex MIN = DBL_MIN +  DBL_MIN * I;
     54const long double _Complex MIN = LDBL_MIN + LDBL_MIN * I;
    5055
    51 const double PI = 3.14159265358979323846_D;                             // pi
    52 const double PI_2 = 1.57079632679489661923_D;                   // pi / 2
    53 const double PI_4 = 0.78539816339744830962_D;                   // pi / 4
    54 const double _1_PI = 0.31830988618379067154_D;                  // 1 / pi
    55 const double _2_PI = 0.63661977236758134308_D;                  // 2 / pi
    56 const double _2_SQRT_PI = 1.12837916709551257390_D;             // 2 / sqrt(pi)
     56const float MAX = FLT_MAX;
     57const double MAX = DBL_MAX;
     58const long double MAX = LDBL_MAX;
     59const float _Complex MAX = FLT_MAX + FLT_MAX * I;
     60const double _Complex MAX = DBL_MAX + DBL_MAX * I;
     61const long double _Complex MAX = LDBL_MAX + LDBL_MAX * I;
    5762
    58 const long double PI = 3.1415926535897932384626433832795029_DL; // pi
    59 const long double PI_2 = 1.5707963267948966192313216916397514_DL; // pi / 2
    60 const long double PI_4 = 0.7853981633974483096156608458198757_DL; // pi / 4
    61 const long double _1_PI = 0.3183098861837906715377675267450287_DL; // 1 / pi
    62 const long double _2_PI = 0.6366197723675813430755350534900574_DL; // 2 / pi
    63 const long double _2_SQRT_PI = 1.1283791670955125738961589031215452_DL; // 2 / sqrt(pi)
     63const float PI = (float)M_PI;                                                   // pi
     64const float PI_2 = (float)M_PI_2;                                               // pi / 2
     65const float PI_4 = (float)M_PI_4;                                               // pi / 4
     66const float _1_PI = (float)M_1_PI;                                              // 1 / pi
     67const float _2_PI = (float)M_2_PI;                                              // 2 / pi
     68const float _2_SQRT_PI = (float)M_2_SQRTPI;                             // 2 / sqrt(pi)
    6469
    65 const double _Complex PI = 3.14159265358979323846_D+0.0_iD;     // pi
    66 const double _Complex PI_2 = 1.57079632679489661923_D+0.0_iD; // pi / 2
    67 const double _Complex PI_4 = 0.78539816339744830962_D+0.0_iD; // pi / 4
    68 const double _Complex _1_PI = 0.31830988618379067154_D+0.0_iD; // 1 / pi
    69 const double _Complex _2_PI = 0.63661977236758134308_D+0.0_iD; // 2 / pi
    70 const double _Complex _2_SQRT_PI = 1.12837916709551257390_D+0.0_iD; // 2 / sqrt(pi)
     70const double PI = M_PI;                                                                 // pi
     71const double PI_2 = M_PI_2;                                                             // pi / 2
     72const double PI_4 = M_PI_4;                                                             // pi / 4
     73const double _1_PI = M_1_PI;                                                    // 1 / pi
     74const double _2_PI = M_2_PI;                                                    // 2 / pi
     75const double _2_SQRT_PI = M_2_SQRTPI;                                   // 2 / sqrt(pi)
    7176
    72 const long double _Complex PI = 3.1415926535897932384626433832795029_L+0.0iL; // pi
    73 const long double _Complex PI_2 = 1.5707963267948966192313216916397514_L+0.0iL; // pi / 2
    74 const long double _Complex PI_4 = 0.7853981633974483096156608458198757_L+0.0iL; // pi / 4
    75 const long double _Complex _1_PI = 0.3183098861837906715377675267450287_L+0.0iL; // 1 / pi
    76 const long double _Complex _2_PI = 0.6366197723675813430755350534900574_L+0.0iL; // 2 / pi
    77 const long double _Complex _2_SQRT_PI = 1.1283791670955125738961589031215452_L+0.0iL; // 2 / sqrt(pi)
     77const long double PI = M_PIl;                                                   // pi
     78const long double PI_2 = M_PI_2l;                                               // pi / 2
     79const long double PI_4 = M_PI_4l;                                               // pi / 4
     80const long double _1_PI = M_1_PIl;                                              // 1 / pi
     81const long double _2_PI = M_2_PIl;                                              // 2 / pi
     82const long double _2_SQRT_PI = M_2_SQRTPIl;                             // 2 / sqrt(pi)
    7883
    79 const float E = 2.718281;                                                               // e
    80 const float LOG2_E = 1.442695;                                                  // log_2(e)
    81 const float LOG10_E = 0.4342944;                                                // log_10(e)
    82 const float LN_2 = 0.6931471;                                                   // log_e(2)
    83 const float LN_10 = 2.302585;                                                   // log_e(10)
    84 const float SQRT_2 = 1.414213;                                                  // sqrt(2)
    85 const float _1_SQRT_2 = 0.7071067;                                              // 1 / sqrt(2)
     84const float _Complex PI = (float)M_PI + 0.0_iF;                 // pi
     85const float _Complex PI_2 = (float)M_PI_2 + 0.0_iF;             // pi / 2
     86const float _Complex PI_4 = (float)M_PI_4 + 0.0_iF;             // pi / 4
     87const float _Complex _1_PI = (float)M_1_PI + 0.0_iF;    // 1 / pi
     88const float _Complex _2_PI = (float)M_2_PI + 0.0_iF;    // 2 / pi
     89const float _Complex _2_SQRT_PI = (float)M_2_SQRTPI + 0.0_iF; // 2 / sqrt(pi)
    8690
    87 const double E = 2.7182818284590452354_D;                               // e
    88 const double LOG2_E = 1.4426950408889634074_D;                  // log_2(e)
    89 const double LOG10_E = 0.43429448190325182765_D;                // log_10(e)
    90 const double LN_2 = 0.69314718055994530942_D;                   // log_e(2)
    91 const double LN_10 = 2.30258509299404568402_D;                  // log_e(10)
    92 const double SQRT_2 = 1.41421356237309504880_D;                 // sqrt(2)
    93 const double _1_SQRT_2 = 0.70710678118654752440_D;              // 1 / sqrt(2)
     91const double _Complex PI = M_PI + 0.0_iD;                               // pi
     92const double _Complex PI_2 = M_PI_2 + 0.0_iD;                   // pi / 2
     93const double _Complex PI_4 = M_PI_4 + 0.0_iD;                   // pi / 4
     94const double _Complex _1_PI = M_1_PI + 0.0_iD;                  // 1 / pi
     95const double _Complex _2_PI = M_2_PI + 0.0_iD;                  // 2 / pi
     96const double _Complex _2_SQRT_PI = M_2_SQRTPI + 0.0_iD; // 2 / sqrt(pi)
    9497
    95 const long double E = 2.7182818284590452353602874713526625_DL; // e
    96 const long double LOG2_E = 1.4426950408889634073599246810018921_DL; // log_2(e)
    97 const long double LOG10_E = 0.4342944819032518276511289189166051_DL; // log_10(e)
    98 const long double LN_2 = 0.6931471805599453094172321214581766_DL; // log_e(2)
    99 const long double LN_10 = 2.3025850929940456840179914546843642_DL; // log_e(10)
    100 const long double SQRT_2 = 1.4142135623730950488016887242096981_DL; // sqrt(2)
    101 const long double _1_SQRT_2 = 0.7071067811865475244008443621048490_DL; // 1/sqrt(2)
     98const long double _Complex PI = M_PIl + 0.0_iL;                 // pi
     99const long double _Complex PI_2 = M_PI_2l + 0.0_iL;             // pi / 2
     100const long double _Complex PI_4 = M_PI_4l + 0.0_iL;             // pi / 4
     101const long double _Complex _1_PI = M_1_PIl + 0.0_iL;    // 1 / pi
     102const long double _Complex _2_PI = M_2_PIl + 0.0_iL;    // 2 / pi
     103const long double _Complex _2_SQRT_PI = M_2_SQRTPIl + 0.0_iL; // 2 / sqrt(pi)
    102104
    103 const double _Complex E = 2.7182818284590452354_D+0.0_iD; // e
    104 const double _Complex LOG2_E = 1.4426950408889634074_D+0.0_iD; // log_2(e)
    105 const double _Complex LOG10_E = 0.43429448190325182765_D+0.0_iD; // log_10(e)
    106 const double _Complex LN_2 = 0.69314718055994530942_D+0.0_iD; // log_e(2)
    107 const double _Complex LN_10 = 2.30258509299404568402_D+0.0_iD; // log_e(10)
    108 const double _Complex SQRT_2 = 1.41421356237309504880_D+0.0_iD; // sqrt(2)
    109 const double _Complex _1_SQRT_2 = 0.70710678118654752440_D+0.0_iD; // 1 / sqrt(2)
     105const float E = (float)M_E;                                                             // e
     106const float LOG2_E = (float)M_LOG2E;                                    // log_2(e)
     107const float LOG10_E = (float)M_LOG10E;                                  // log_10(e)
     108const float LN_2 = (float)M_LN2;                                                // log_e(2)
     109const float LN_10 = (float)M_LN10;                                              // log_e(10)
     110const float SQRT_2 = (float)M_SQRT2;                                    // sqrt(2)
     111const float _1_SQRT_2 = (float)M_SQRT1_2;                               // 1 / sqrt(2)
    110112
    111 const long double _Complex E = 2.7182818284590452353602874713526625_L+0.0_iL; // e
    112 const long double _Complex LOG2_E = 1.4426950408889634073599246810018921_L+0.0_iL; // log_2(e)
    113 const long double _Complex LOG10_E = 0.4342944819032518276511289189166051_L+0.0_iL; // log_10(e)
    114 const long double _Complex LN_2 = 0.6931471805599453094172321214581766_L+0.0_iL; // log_e(2)
    115 const long double _Complex LN_10 = 2.3025850929940456840179914546843642_L+0.0_iL; // log_e(10)
    116 const long double _Complex SQRT_2 = 1.4142135623730950488016887242096981_L+0.0_iL; // sqrt(2)
    117 const long double _Complex _1_SQRT_2 = 0.7071067811865475244008443621048490_L+0.0_iL; // 1 / sqrt(2)
     113const double E = M_E;                                                                   // e
     114const double LOG2_E = M_LOG2E;                                                  // log_2(e)
     115const double LOG10_E = M_LOG10E;                                                // log_10(e)
     116const double LN_2 = M_LN2;                                                              // log_e(2)
     117const double LN_10 = M_LN10;                                                    // log_e(10)
     118const double SQRT_2 = M_SQRT2;                                                  // sqrt(2)
     119const double _1_SQRT_2 = M_SQRT1_2;                                             // 1 / sqrt(2)
     120
     121const long double E = M_El;                                                             // e
     122const long double LOG2_E = M_LOG2El;                                    // log_2(e)
     123const long double LOG10_E = M_LOG10El;                                  // log_10(e)
     124const long double LN_2 = M_LN2l;                                                // log_e(2)
     125const long double LN_10 = M_LN10l;                                              // log_e(10)
     126const long double SQRT_2 = M_SQRT2l;                                    // sqrt(2)
     127const long double _1_SQRT_2 = M_SQRT1_2l;                               // 1 / sqrt(2)
     128
     129const float _Complex E = M_E + 0.0_iF;                                  // e
     130const float _Complex LOG2_E = M_LOG2E + 0.0_iF;                 // log_2(e)
     131const float _Complex LOG10_E = M_LOG10E + 0.0_iF;               // log_10(e)
     132const float _Complex LN_2 = M_LN2 + 0.0_iF;                             // log_e(2)
     133const float _Complex LN_10 = M_LN10 + 0.0_iF;                   // log_e(10)
     134const float _Complex SQRT_2 = M_SQRT2 + 0.0_iF;                 // sqrt(2)
     135const float _Complex _1_SQRT_2 = M_SQRT1_2 + 0.0_iF;    // 1 / sqrt(2)
     136
     137const double _Complex E = M_E + 0.0_iD;                                 // e
     138const double _Complex LOG2_E = M_LOG2E + 0.0_iD;                // log_2(e)
     139const double _Complex LOG10_E = M_LOG10E + 0.0_iD;              // log_10(e)
     140const double _Complex LN_2 = M_LN2 + 0.0_iD;                    // log_e(2)
     141const double _Complex LN_10 = M_LN10 + 0.0_iD;                  // log_e(10)
     142const double _Complex SQRT_2 = M_SQRT2 + 0.0_iD;                // sqrt(2)
     143const double _Complex _1_SQRT_2 = M_SQRT1_2 + 0.0_iD;   // 1 / sqrt(2)
     144
     145const long double _Complex E = M_El + 0.0_iL;                   // e
     146const long double _Complex LOG2_E = M_LOG2El + 0.0_iL;  // log_2(e)
     147const long double _Complex LOG10_E = M_LOG10El + 0.0_iL; // log_10(e)
     148const long double _Complex LN_2 = M_LN2l + 0.0_iL;              // log_e(2)
     149const long double _Complex LN_10 = M_LN10l + 0.0_iL;    // log_e(10)
     150const long double _Complex SQRT_2 = M_SQRT2l + 0.0_iL;  // sqrt(2)
     151const long double _Complex _1_SQRT_2 = M_SQRT1_2l + 0.0_iL; // 1 / sqrt(2)
    118152
    119153// Local Variables: //
  • src/tests/.expect/KRfunctions.x86.txt

    r094476d rcaa649b  
    8282    signed int __a__i_2;
    8383    signed int __b__i_2;
    84     signed int *(*_tmp_cp_ret0)(signed int __x__i_1, signed int __y__i_1);
    85     ((void)(__x__PFPi_ii__2=(((void)(_tmp_cp_ret0=__f10__FPFPi_ii__iPiPid__1(3, (&__a__i_2), (&__b__i_2), 3.5))) , _tmp_cp_ret0)));
    86     ((void)(_tmp_cp_ret0) /* ^?{} */);
     84    signed int *(*_tmp_cp_ret2)(signed int __x__i_1, signed int __y__i_1);
     85    ((void)(__x__PFPi_ii__2=(((void)(_tmp_cp_ret2=__f10__FPFPi_ii__iPiPid__1(3, (&__a__i_2), (&__b__i_2), 3.5))) , _tmp_cp_ret2)));
     86    ((void)(_tmp_cp_ret2) /* ^?{} */);
    8787    const signed int __f1__FCi_iPiPi__2(signed int __a__i_2, signed int *__b__Pi_2, signed int *__c__Pi_2){
    8888        __attribute__ ((unused)) const signed int ___retval_f1__Ci_2;
  • src/tests/.expect/literals.x64.txt

    r094476d rcaa649b  
    522522signed int __main__Fi___1(){
    523523    __attribute__ ((unused)) signed int ___retval_main__i_1;
     524    ((void)0b01101011);
     525    ((void)0b01101011u);
     526    ((void)0b01101011l);
     527    ((void)0b01101011ll);
     528    ((void)0b01101011ul);
     529    ((void)0b01101011lu);
     530    ((void)0b01101011ull);
     531    ((void)0b01101011llu);
     532    ((void)(+0b01101011));
     533    ((void)(+0b01101011u));
     534    ((void)(+0b01101011l));
     535    ((void)(+0b01101011ll));
     536    ((void)(+0b01101011ul));
     537    ((void)(+0b01101011lu));
     538    ((void)(+0b01101011ull));
     539    ((void)(+0b01101011llu));
     540    ((void)(-0b01101011));
     541    ((void)(-0b01101011u));
     542    ((void)(-0b01101011l));
     543    ((void)(-0b01101011ll));
     544    ((void)(-0b01101011ul));
     545    ((void)(-0b01101011lu));
     546    ((void)(-0b01101011ull));
     547    ((void)(-0b01101011llu));
    524548    ((void)01234567);
    525549    ((void)01234567u);
     
    10171041    ((void)(-0X0123456789.0123456789P-09F));
    10181042    ((void)(-0X0123456789.0123456789P-09L));
     1043    ((void)((signed char )0b01101011));
     1044    ((void)((signed short int )0b01101011));
     1045    ((void)((signed int )0b01101011));
     1046    ((void)((signed long int )0b01101011));
     1047    ((void)((__int128 )0b01101011));
     1048    ((void)((unsigned char )0b01101011u));
     1049    ((void)((signed short int )0b01101011u));
     1050    ((void)((unsigned int )0b01101011u));
     1051    ((void)((signed long int )0b01101011u));
     1052    ((void)((__int128 )0b01101011u));
     1053    ((void)(+((signed int )((signed char )0b01101011))));
     1054    ((void)(+((signed int )((signed short int )0b01101011))));
     1055    ((void)(+((signed int )0b01101011)));
     1056    ((void)(+((signed long int )0b01101011)));
     1057    ((void)(+((float )((__int128 )0b01101011))));
     1058    ((void)(+((signed int )((unsigned char )0b01101011u))));
     1059    ((void)(+((signed int )((signed short int )0b01101011u))));
     1060    ((void)(+((unsigned int )0b01101011u)));
     1061    ((void)(+((signed long int )0b01101011u)));
     1062    ((void)(+((float )((__int128 )0b01101011u))));
     1063    ((void)(-((signed int )((signed char )0b01101011))));
     1064    ((void)(-((signed int )((signed short int )0b01101011))));
     1065    ((void)(-((signed int )0b01101011)));
     1066    ((void)(-((signed long int )0b01101011)));
     1067    ((void)(-((float )((__int128 )0b01101011))));
     1068    ((void)(-((signed int )((unsigned char )0b01101011u))));
     1069    ((void)(-((signed int )((signed short int )0b01101011u))));
     1070    ((void)(-((unsigned int )0b01101011u)));
     1071    ((void)(-((signed long int )0b01101011u)));
     1072    ((void)(-((float )((__int128 )0b01101011u))));
    10191073    ((void)((signed char )01234567));
    10201074    ((void)((signed short int )01234567));
  • src/tests/.expect/user_literals.txt

    r094476d rcaa649b  
    1111.0714285714286
    2 11.07225
     215
    3311.0714285714286
     424.8
     511.248
    4611.0714285714286
    5 11.0714285714286
    6 22.0457142857143
     728.0657142857143
    78secs 1
    89secs 23
  • src/tests/Makefile.am

    r094476d rcaa649b  
    123123        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
    124124
     125# Warnings
     126warnings/self-assignment: warnings/self-assignment.c @CFA_BINDIR@/@CFA_NAME@
     127        ${CC} ${AM_CFLAGS} ${CFLAGS} ${<} 2> ${@} -fsyntax-only
  • src/tests/Makefile.in

    r094476d rcaa649b  
    800800        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
    801801
     802# Warnings
     803warnings/self-assignment: warnings/self-assignment.c @CFA_BINDIR@/@CFA_NAME@
     804        ${CC} ${AM_CFLAGS} ${CFLAGS} ${<} 2> ${@} -fsyntax-only
     805
    802806# Tell versions [3.59,3.63) of GNU make to not export all variables.
    803807# Otherwise a system limit (for SysV at least) may be exceeded.
  • src/tests/limits.c

    r094476d rcaa649b  
    1010// Created On       : Tue May 10 20:44:20 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May 10 20:45:28 2016
    13 // Update Count     : 1
     12// Last Modified On : Thu Mar  1 16:21:55 2018
     13// Update Count     : 7
    1414//
    1515
     
    1818// Integral Constants
    1919
     20signed char m = MIN;
     21unsigned char m = MIN;
    2022short int m = MIN;
     23unsigned short int m = MIN;
    2124int m = MIN;
     25unsigned int m = MIN;
    2226long int m = MIN;
     27unsigned long int m = MIN;
    2328long long int m = MIN;
     29unsigned long long int m = MIN;
    2430
     31signed char M = MAX;
     32unsigned char M = MAX;
    2533short int M = MAX;
    2634unsigned short int M = MAX;
     
    3341
    3442// Floating-Point Constants
     43
     44float m = MIN;
     45double m = MIN;
     46long double m = MIN;
     47float _Complex m = MIN;
     48double _Complex m = MIN;
     49long double _Complex m = MIN;
     50
     51float M = MAX;
     52double M = MAX;
     53long double M = MAX;
     54float _Complex M = MAX;
     55double _Complex M = MAX;
     56long double _Complex M = MAX;
    3557
    3658float pi = PI;
     
    5577long double _2_sqrt_pi = _2_SQRT_PI;
    5678
    57 _Complex pi = PI;
    58 _Complex pi_2 = PI_2;
    59 _Complex pi_4 = PI_4;
    60 _Complex _1_pi = _1_PI;
    61 _Complex _2_pi = _2_PI;
    62 _Complex _2_sqrt_pi = _2_SQRT_PI;
     79float _Complex pi = PI;
     80float _Complex pi_2 = PI_2;
     81float _Complex pi_4 = PI_4;
     82float _Complex _1_pi = _1_PI;
     83float _Complex _2_pi = _2_PI;
     84float _Complex _2_sqrt_pi = _2_SQRT_PI;
    6385
    64 long _Complex pi = PI;
    65 long _Complex pi_2 = PI_2;
    66 long _Complex pi_4 = PI_4;
    67 long _Complex _1_pi = _1_PI;
    68 long _Complex _2_pi = _2_PI;
    69 long _Complex _2_sqrt_pi = _2_SQRT_PI;
     86double _Complex pi = PI;
     87double _Complex pi_2 = PI_2;
     88double _Complex pi_4 = PI_4;
     89double _Complex _1_pi = _1_PI;
     90double _Complex _2_pi = _2_PI;
     91double _Complex _2_sqrt_pi = _2_SQRT_PI;
     92
     93long double _Complex pi = PI;
     94long double _Complex pi_2 = PI_2;
     95long double _Complex pi_4 = PI_4;
     96long double _Complex _1_pi = _1_PI;
     97long double _Complex _2_pi = _2_PI;
     98long double _Complex _2_sqrt_pi = _2_SQRT_PI;
    7099
    71100float e = E;
     
    93122long double _1_sqrt_2 = _1_SQRT_2;
    94123
    95 _Complex e = E;
    96 _Complex log2_e = LOG2_E;
    97 _Complex log10_e = LOG10_E;
    98 _Complex ln_2 = LN_2;
    99 _Complex ln_10 = LN_10;
    100 _Complex sqrt_2 = SQRT_2;
    101 _Complex _1_sqrt_2 = _1_SQRT_2;
     124float _Complex e = E;
     125float _Complex log2_e = LOG2_E;
     126float _Complex log10_e = LOG10_E;
     127float _Complex ln_2 = LN_2;
     128float _Complex ln_10 = LN_10;
     129float _Complex sqrt_2 = SQRT_2;
     130float _Complex _1_sqrt_2 = _1_SQRT_2;
    102131
    103 long _Complex e = E;
    104 long _Complex log2_e = LOG2_E;
    105 long _Complex log10_e = LOG10_E;
    106 long _Complex ln_2 = LN_2;
    107 long _Complex ln_10 = LN_10;
    108 long _Complex sqrt_2 = SQRT_2;
    109 long _Complex _1_sqrt_2 = _1_SQRT_2;
     132double _Complex e = E;
     133double _Complex log2_e = LOG2_E;
     134double _Complex log10_e = LOG10_E;
     135double _Complex ln_2 = LN_2;
     136double _Complex ln_10 = LN_10;
     137double _Complex sqrt_2 = SQRT_2;
     138double _Complex _1_sqrt_2 = _1_SQRT_2;
     139
     140long double _Complex e = E;
     141long double _Complex log2_e = LOG2_E;
     142long double _Complex log10_e = LOG10_E;
     143long double _Complex ln_2 = LN_2;
     144long double _Complex ln_10 = LN_10;
     145long double _Complex sqrt_2 = SQRT_2;
     146long double _Complex _1_sqrt_2 = _1_SQRT_2;
    110147
    111148int main(int argc, char const *argv[]) {
  • src/tests/literals.c

    r094476d rcaa649b  
    1010// Created On       : Sat Sep  9 16:34:38 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 25 20:26:00 2017
    13 // Update Count     : 132
     12// Last Modified On : Sun Mar  4 10:41:31 2018
     13// Update Count     : 134
    1414//
    1515
     
    3131// integer literals
    3232
     33        // binary
     34         0b01101011;   0b01101011u;   0b01101011l;   0b01101011ll;   0b01101011ul;   0b01101011lu;   0b01101011ull;   0b01101011llu;
     35        +0b01101011;  +0b01101011u;  +0b01101011l;  +0b01101011ll;  +0b01101011ul;  +0b01101011lu;  +0b01101011ull;  +0b01101011llu;
     36        -0b01101011;  -0b01101011u;  -0b01101011l;  -0b01101011ll;  -0b01101011ul;  -0b01101011lu;  -0b01101011ull;  -0b01101011llu;
     37
    3338        // octal
    3439         01234567;   01234567u;   01234567l;   01234567ll;   01234567ul;   01234567lu;   01234567ull;   01234567llu;
     
    148153#ifdef __CFA__
    149154// fixed-size length
     155
     156        // binary
     157         0b01101011_l8;   0b01101011_l16;   0b01101011_l32;   0b01101011_l64;   0b01101011_l128;   0b01101011_l8u;   0b01101011_ul16;   0b01101011_l32u;   0b01101011_ul64;   0b01101011_ul128;
     158        +0b01101011_l8;  +0b01101011_l16;  +0b01101011_l32;  +0b01101011_l64;  +0b01101011_l128;  +0b01101011_l8u;  +0b01101011_ul16;  +0b01101011_l32u;  +0b01101011_ul64;  +0b01101011_ul128;
     159        -0b01101011_l8;  -0b01101011_l16;  -0b01101011_l32;  -0b01101011_l64;  -0b01101011_l128;  -0b01101011_l8u;  -0b01101011_ul16;  -0b01101011_l32u;  -0b01101011_ul64;  -0b01101011_ul128;
    150160
    151161        // octal
  • src/tests/user_literals.c

    r094476d rcaa649b  
    1010// Created On       : Wed Sep  6 21:40:50 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Dec  7 09:12:36 2017
    13 // Update Count     : 50
     12// Last Modified On : Sun Mar  4 11:14:02 2018
     13// Update Count     : 52
    1414//
    1515
     
    3131
    3232
    33 struct Weight {
    34         double stones;
    35 };
    36 void ?{}( Weight & w ) { w.stones = 0; }                                // operations
     33struct Weight { double stones; };
     34void ?{}( Weight & w ) { w.stones = 0; }
    3735void ?{}( Weight & w, double w ) { w.stones = w; }
    38 Weight ?+?( Weight l, Weight r ) { return (Weight){ l.stones + r.stones }; }
     36Weight ?+?( Weight l, Weight r ) {
     37        return (Weight){ l.stones + r.stones };
     38}
    3939ofstream & ?|?( ofstream & os, Weight w ) { return os | w.stones; }
    4040
    4141Weight ?`st( double w ) { return (Weight){ w }; }               // backquote for user literals
    4242Weight ?`lb( double w ) { return (Weight){ w / 14.0 }; }
    43 Weight ?`kg( double w ) { return (Weight) { w * 0.1575}; }
    44 
     43Weight ?`kg( double w ) { return (Weight) { w * 0.16 }; }
    4544
    4645int main() {
    47         Weight w, hw = { 14 };                                                          // 14 stone
    48         w = 11`st + 1`lb;
     46        Weight w, heavy = { 20 };                                                       // 20 stone
     47        w = 155`lb;
     48        sout | w | endl;
     49        w = 0b_1111`st;
     50        sout | w | endl;
     51        w = 0_233`lb;                                                                           // octal weight (155)
     52        sout | w | endl;
     53        w = 0x_9b_u`kg;
    4954        sout | w | endl;
    5055        w = 70.3`kg;
    5156        sout | w | endl;
    52         w = 155`lb;
     57        w = 11`st + 1`lb;
    5358        sout | w | endl;
    54         w = 0x_9b_u`lb;                                                                         // hexadecimal unsigned weight (155)
    55         sout | w | endl;
    56         w = 0_233`lb;                                                                           // octal weight (155)
    57         sout | w | endl;
    58         w = 5`st + 8`kg + 25`lb + hw;
     59        w = 5`st + 8`kg + 25`lb + heavy;
    5960        sout | w | endl;
    6061
Note: See TracChangeset for help on using the changeset viewer.