fix extern inline handling, implement __builtin_huge_val
authorMatthias Braun <matze@braunis.de>
Fri, 30 May 2008 18:11:00 +0000 (18:11 +0000)
committerMatthias Braun <matze@braunis.de>
Fri, 30 May 2008 18:11:00 +0000 (18:11 +0000)
[r19862]

ast2firm.c
parser.c
tokens.inc

index 2a40532..cb640ab 100644 (file)
@@ -1379,6 +1379,12 @@ static ir_node *process_builtin_call(const call_expression_t *call)
 
                return res;
        }
+       case T___builtin_huge_val: {
+               ir_mode *mode = get_ir_mode(function_type->function.return_type);
+               tarval  *tv   = get_mode_infinite(mode);
+               ir_node *res  = new_d_Const(dbgi, mode, tv);
+               return   res;
+       }
        case T___builtin_nan:
        case T___builtin_nanf:
        case T___builtin_nand: {
index 338c975..a5e0d26 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -3923,6 +3923,9 @@ warn_redundant_declaration:
                                        }
                                }
                        }
+
+                       if (declaration->is_inline)
+                               previous_declaration->is_inline = true;
                        return previous_declaration;
                }
        } else if (is_function_definition) {
@@ -4816,6 +4819,20 @@ static type_t *make_function_1_type(type_t *return_type, type_t *argument_type)
        return result;
 }
 
+static type_t *make_function_0_type(type_t *return_type)
+{
+       type_t *type               = allocate_type_zero(TYPE_FUNCTION, &builtin_source_position);
+       type->function.return_type = return_type;
+       type->function.parameters  = NULL;
+
+       type_t *result = typehash_insert(type);
+       if(result != type) {
+               free_type(type);
+       }
+
+       return result;
+}
+
 /**
  * Creates a function type for some function like builtins.
  *
@@ -4826,6 +4843,8 @@ static type_t *get_builtin_symbol_type(symbol_t *symbol)
        switch(symbol->ID) {
        case T___builtin_alloca:
                return make_function_1_type(type_void_ptr, type_size_t);
+       case T___builtin_huge_val:
+               return make_function_0_type(type_double);
        case T___builtin_nan:
                return make_function_1_type(type_double, type_char_ptr);
        case T___builtin_nanf:
@@ -5532,6 +5551,7 @@ static expression_t *parse_primary_expression(void)
                case T___builtin_nan:
                case T___builtin_nand:
                case T___builtin_nanf:
+               case T___builtin_huge_val:
                case T___builtin_va_end:         return parse_builtin_symbol();
                case T___builtin_isgreater:
                case T___builtin_isgreaterequal:
index 67af5e8..7f72fb0 100644 (file)
@@ -66,6 +66,7 @@ S(_ALL, __builtin_islessgreater)
 S(_ALL, __builtin_isunordered)
 S(_ALL, __builtin_constant_p)
 S(_ALL, __builtin_prefetch)
+S(_ALL, __builtin_huge_val)
 S(_ALL, __PRETTY_FUNCTION__)
 S(_ALL, __FUNCTION__)
 S(_C99, __func__)