Exemplo n.º 1
0
int main()
{
    int gbl_derived = Derived::count;
    
    test_regular();
    if( Derived::count != gbl_derived ) {
        printf( "RET06 FAILURE: Some Derived not DTORED\n" );
        ++errors;
    }
    test_extern_c();
    if( Derived::count != gbl_derived ) {
        printf( "RET06 FAILURE: Some Derived not DTORED\n" );
        ++errors;
    }

    _PASS;
}
Exemplo n.º 2
0
int
main(int argc, char ** argv)
{
	HC_PROC_INIT(argv, GRID_LOGLVL_TRACE2);

	(void) argc;
	sqlx_cache_t *cache = sqlx_cache_init();
	g_assert(cache != NULL);
	sqlx_cache_set_close_hook(cache, sqlite_close);

	test_fail(cache);
	test_regular(cache);

	sqlx_cache_debug(cache);
	sqlx_cache_expire(cache, 0, NULL, NULL);
	sqlx_cache_clean(cache);
	return 0;
}
Exemplo n.º 3
0
void test_movable(const T& x)
{
    assert(x != T());
    assert(is_movable<T>::value);
    
    test_regular(x);
    
    T y = x;
    // move construction (and RVO)
    const void* addr = remote_address(y);
    T z = move(y);
    BOOST_CHECK(y == T());
    BOOST_CHECK(z == x);
    BOOST_CHECK(remote_address(z) == addr);
    // move assignment
    y = move(z);
    BOOST_CHECK(z == T());
    BOOST_CHECK(y == x);
    BOOST_CHECK(remote_address(y) == addr);
}
Exemplo n.º 4
0
struct Symbol* unary_expression(struct UnaryExpression* node, struct Symbol** orig_symbol)
{
    int len;
    struct Symbol *symbol, *symbol1 = NULL;
    switch (node->type) {
        case 0:
            return postfix_expression(node->postfixExpression, orig_symbol);
        case 1:
        case 2:
            symbol = load_symbol(unary_expression(node->unaryExpression, orig_symbol));
            test_changeable(*orig_symbol);
            if (node->type == 2)
                symbol1 = test_calculable(symbol, '-');
            else
                symbol1 = test_calculable(symbol, '+');
            if (symbol1)
                return symbol1;
            ADDSTRING("  ");
            symbol1 = new_symbol("", symbol->storage, symbol->qualifier, symbol->specifier, symbol->stars - 1, 0, symbol->length);
            code_gen_symbol('%', symbol1);
            ADDSTRING(" = ");
            if ((symbol->specifier & (3 << 6)) > 0)
            {
                ADDSTRING("f");
            }
            if (node->type == 1)
            {
                ADDSTRING("add ");
            }
            else
            {
                ADDSTRING("sub ");
            }
            code_gen_type_specifier(symbol->specifier,1,symbol->length, symbol->stars);
            ADDSTRING(" ");
            code_gen_symbol('%', symbol);
            ADDSTRING(", ");
            if ((symbol->specifier & (3 << 6)) > 0)
            {
                ADDSTRING("1.000000e+00\n");
            }
            else
            {
                ADDSTRING("1\n");
            }
            ADDSTRING("  store ");
            code_gen_type_specifier(symbol->specifier,0,symbol->length, symbol->stars);
            ADDSTRING(" ");
            code_gen_symbol('%', symbol1);
            ADDSTRING(", ");
            code_gen_type_specifier(symbol->specifier,0,symbol->length, symbol->stars);
            ADDSTRING("* ");
            code_gen_symbol('%', *orig_symbol);
            ADDSTRING(", align ");
            int l = len_gen_type_specifier(symbol->specifier);
            sprintf(buf, "%d", l);
            ADDSTRING(buf);
            ADDSTRING("\n");
            *orig_symbol = 0;
            break;
            
        case 3:
            symbol = cast_expression(node->castExpression);
            switch (node->unaryOperator) {
                case 1:
                    test_pointable(symbol);
                    symbol = symbol->reference;
                    *orig_symbol = 0;
                    symbol1 = new_symbol("", symbol->storage, 2, symbol->specifier, symbol->stars + 1, 0, symbol->length);
                    ADDSTRING("  ");
                    code_gen_symbol('%', symbol1);
                    ADDSTRING(" = getelementptr inbounds ");
                    code_gen_type_specifier(symbol->specifier, 0, symbol->length, symbol1->stars);
                    ADDSTRING(" ");
                    code_gen_symbol('%', symbol);
                    ADDSTRING(", ");
                    ADDSTRING(PTR_LEN_TYPE);
                    ADDSTRING(" 0\n");
                    break;
                case 2:
                    test_referenceable(symbol);
                    symbol = load_symbol(symbol);
                    symbol1 = new_symbol("", symbol->storage, 0, symbol->specifier, symbol->stars - 1, 0, symbol->length);
                    *orig_symbol = symbol1;
                    if (symbol1->stars == 0)
                        symbol1->specifier = 32;
                    symbol1->reference = symbol;
                    ADDSTRING("  ");
                    code_gen_symbol('%', symbol1);
                    ADDSTRING(" = load ");
                    code_gen_type_specifier(symbol->specifier, 0, symbol->length, symbol->stars);
                    ADDSTRING(" ");
                    code_gen_symbol('%', symbol);
                    ADDSTRING(" ");
                    code_gen_symbol('%', symbol);
                    ADDSTRING(", align 8\n");
                    break;
                case 3:
                    test_regular(symbol);
                    symbol1 = symbol;
                    *orig_symbol = 0;
                    break;
                case 4:
                    test_regular(symbol);
                    symbol = load_symbol(symbol);
                    symbol1 = test_calculable(symbol, 'n');
                    if (symbol1)
                    {
                        return symbol1;
                    }
                    symbol1 = new_symbol("", symbol->storage, 2, symbol->specifier, symbol->stars, 0, 0);
                    *orig_symbol = symbol;
                    ADDSTRING("  ");
                    code_gen_symbol('%', symbol1);
                    if ((symbol->specifier & (3 << 6)) != 0)
                    {
                        ADDSTRING(" = f");
                    }
                    else
                    {
                        ADDSTRING(" = ");
                    }
                    ADDSTRING("sub ");
                    code_gen_type_specifier(symbol->specifier,1, symbol->length, symbol->stars);
                    ADDSTRING(" ");
                    if ((symbol->specifier & (3 << 6)) != 0)
                    {
                        ADDSTRING("0.000000e+00");
                    }
                    else
                    {
                        ADDSTRING("0");
                    }
                    ADDSTRING(", ");
                    code_gen_symbol('%', symbol);
                    ADDSTRING("\n");
                    *orig_symbol = 0;
                    break;
                case 5:
                    test_integer(symbol);
                    symbol = load_symbol(symbol);
                    symbol1 = test_calculable(symbol, '~');
                    if (symbol1)
                    {
                        return symbol1;
                    }
                    *orig_symbol = 0;
                    symbol = cast_symbol(symbol, 16, 0);
                    symbol1 = new_symbol("", symbol->storage, symbol->qualifier, symbol->specifier, symbol->stars, 0, symbol->length);
                    ADDSTRING("  ");
                    code_gen_symbol('%', symbol1);
                    ADDSTRING(" = xor ");
                    code_gen_type_specifier(symbol->specifier,0, symbol->length, symbol->stars);
                    ADDSTRING(" ");
                    code_gen_symbol('%', symbol);
                    ADDSTRING(", -1");
                    ADDSTRING("\n");
                    break;
                case 6:
                    *orig_symbol = 0;
                    symbol1 = test_calculable(symbol, '!');
                    symbol = load_symbol(symbol);
                    if (symbol1)
                    {
                        return symbol1;
                    }
                    symbol1 = new_symbol("0", 0, 2, 16, 0, 2, 0);
                    symbol1 = equality_symbol(symbol, symbol1, 2, 1);
                    break;
                default:
                    break;
            }
            break;
            
        case 4:
            *orig_symbol = 0;
            symbol = unary_expression(node->unaryExpression, orig_symbol);
            if (symbol->stars > (symbol->length > 0))
                len = PTR_LENGTH;
            else
            {
                len = len_gen_type_specifier(symbol->specifier);
                if (symbol->length)
                    len *= symbol->length;
            }
            sprintf(buf, "%d", len);
            symbol1 = new_symbol(buf, 0, 2, 4, 0, 2, 0);
            break;
            
        case 5:
            *orig_symbol = 0;
            len = len_gen_type_name(node->typeName);
            sprintf(buf, "%d", len);
            symbol1 = new_symbol(buf, 0, 2, 4, 0, 2, 0);
            break;
            
        default:
            break;
    }
    return symbol1;
}