[llvm-commits] [llvm-gcc-4.2] r62478 - in /llvm-gcc-4.2/trunk/gcc: c-common.c c-common.h c-parser.c c.opt config/i386/darwin.h config/rs6000/darwin.h

Nick Lewycky nicholas at mxc.ca
Sun Jan 18 20:14:21 PST 2009


Bill Wendling wrote:
> Author: void
> Date: Sun Jan 18 20:22:40 2009
> New Revision: 62478
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=62478&view=rev
> Log:
> Don't enable the -Wformat flag for everything. Only for C and friends.
> 
> Modified:
>     llvm-gcc-4.2/trunk/gcc/c-common.c
>     llvm-gcc-4.2/trunk/gcc/c-common.h
>     llvm-gcc-4.2/trunk/gcc/c-parser.c
>     llvm-gcc-4.2/trunk/gcc/c.opt
>     llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h
>     llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin.h
> 
> Modified: llvm-gcc-4.2/trunk/gcc/c-common.c
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-common.c?rev=62478&r1=62477&r2=62478&view=diff
> 
> ==============================================================================
> --- llvm-gcc-4.2/trunk/gcc/c-common.c (original)
> +++ llvm-gcc-4.2/trunk/gcc/c-common.c Sun Jan 18 20:22:40 2009
> @@ -294,6 +294,12 @@
>  
>  int warn_unknown_pragmas; /* Tri state variable.  */
>  
> +/* Warn about format/argument anomalies in calls to formatted I/O functions
> +   (*printf, *scanf, strftime, strfmon, etc.).  */
> +
> +/* APPLE LOCAL default to Wformat-security 5764921 */
> +int warn_format = 1;
> +

Hi Bill,

We need this flag to only be on for Darwin, otherwise it breaks things 
for Linux users. In particular, Google builds with -Werror, and having 
-Wformat set ruins my day and makes llvm-gcc a very poor drop-in 
replacement for gcc. :)

We've been around this before, PR2780 PR2843 PR2995.

Is there some way you can enable this for the C/ObjC/C++ frontend on 
Darwin only? Or maybe enable it on Darwin always and rig the Fortran 
frontend to ignore these flags?

Thanks,
Nick

>  /* Warn about using __null (as NULL in C++) as sentinel.  For code compiled
>     with GCC this doesn't matter as __null is guaranteed to have the right
>     size.  */
> @@ -6243,8 +6249,11 @@
>    char *buf;
>    if (!current_function_decl)
>      {
> +      /* APPLE LOCAL begin radar 6411649 */
> +      static int global_count;
>        buf = (char *)alloca (32);
> -      sprintf (buf, "__block_global_%d", unique_count);
> +      sprintf (buf, "__block_global_%d", ++global_count);
> +      /* APPLE LOCAL end radar 6411649 */
>      }
>    else
>      {
> @@ -6254,6 +6263,10 @@
>               DECL_CONTEXT (outer_decl) && TREE_CODE (DECL_CONTEXT (outer_decl)) == FUNCTION_DECL)
>        /* APPLE LOCAL end radar 6169580 */
>          outer_decl = DECL_CONTEXT (outer_decl);
> +      /* APPLE LOCAL begin radar 6411649 */
> +      if (!unique_count)
> +        unique_count = ++DECL_STRUCT_FUNCTION(outer_decl)->unqiue_block_number;
> +      /* APPLE LOCAL end radar 6411649 */
>        buf = (char *)alloca (IDENTIFIER_LENGTH (DECL_NAME (outer_decl)) + 32); 
>        sprintf (buf, "__%s_block_invoke_%d", 
>  	       IDENTIFIER_POINTER (DECL_NAME (outer_decl)), unique_count);
> @@ -7250,6 +7263,13 @@
>  #define U(X) ""
>  /* This is used to denote the size for testcase generation.  */
>  #define S(X)
> +#define X(X) X
> +#define T(X) X
> +/* Not for x86_64 mode */
> +#define NX ""
> +/* Not yet implemented by the 64-bit assembler, but is in 32-bit assembler. */
> +#define NY ""
> +#define C X(",")
>  
>  #define m8 "m" S("1")
>  #define m16 "m" S("2")
> @@ -7260,22 +7280,18 @@
>  #define r8 "r" S("1")
>  #define r16 "r" S("2")
>  #define r32 "r" S("4")
> -#define r64 U("r" S("8"))
> +#define R64 X("r" S("8"))
>  #define a8 "a" S("1")
>  #define a16 "a" S("2")
>  #define a32 "a" S("4")
>  #define r16r32 r16 r32
> -#define r16r32r64 r16 r32 r64
>  #define r8r16r32 r8 r16 r32
>  #define rm8 r8 m8
>  #define rm16 r16 m16
>  #define rm32 r32 m32
> -#define rm64 r64 m64
>  #define rm8rm16 rm8 rm16
>  #define rm8rm16rm32 rm8 rm16 rm32
> -#define rm8rm16rm32rm64 rm8 rm16 rm32 rm64
>  #define m8m16m32 m8 m16 m32
> -#define r32r64 r32 r64
>  #define ri8 r8 "i"
>  #define ri16 r16 "i"
>  #define ri32 r32 "i"
> @@ -7285,6 +7301,14 @@
>  #define m80fp "m" S("7")
>  #define m32fpm64fp m32fp m64fp
>  #define m32fpm64fpm80fp m32fp m64fp m80fp
> +#define M64 X(m64)
> +#define RM64 R64 M64
> +#define RI64 X(R64 "i")
> +#define r32R64 r32 R64
> +#define r16r32R64 r16 r32 R64
> +#define rm32RM64 rm32 RM64
> +#define rm8rm16rm32RM64 rm8 rm16 rm32 RM64
> +#define m8m16m32M64 m8 m16 m32 M64
>  #endif
>  
>  #ifndef TARGET_IASM_REORDER_ARG
> @@ -7355,6 +7379,14 @@
>  }
>  
>  #if defined(TARGET_386)
> +#undef U
> +#undef S
> +#undef X
> +#undef T
> +#undef NX
> +#undef NY
> +#undef C
> +
>  #undef m8
>  #undef m16
>  #undef m32
> @@ -7364,22 +7396,18 @@
>  #undef r8
>  #undef r16
>  #undef r32
> -#undef r64
> +#undef R64
>  #undef a8
>  #undef a16
>  #undef a32
>  #undef r16r32
> -#undef r16r32r64
>  #undef r8r16r32
>  #undef rm8
>  #undef rm16
>  #undef rm32
> -#undef rm64
>  #undef rm8rm16
>  #undef rm8rm16rm32
> -#undef rm8rm16rm32rm64
>  #undef m8m16m32
> -#undef r32r64
>  #undef ri8
>  #undef ri16
>  #undef ri32
> @@ -7389,9 +7417,13 @@
>  #undef m80fp
>  #undef m32fpm64fp
>  #undef m32fpm64fpm80fp
> -
> -#undef U
> -#undef S
> +#undef M64
> +#undef RM64
> +#undef r32R64
> +#undef r16r32R64
> +#undef rm32RM64
> +#undef rm8rm16rm32RM64
> +#undef m8m16m32M64
>  #endif
>  
>  static void
> @@ -7913,14 +7945,18 @@
>      e.no_label_map = true;
>  #ifdef TARGET_386
>    else if (strcasecmp (opcodename, "call") == 0
> -	   || strcasecmp (opcodename, "jmp") == 0)
> +	   || strncasecmp (opcodename, "j", 1) == 0)
>      {
>        if (args
>  	  && TREE_CODE (TREE_VALUE (args)) != LABEL_DECL
>  	  && TREE_CODE (TREE_VALUE (args)) != FUNCTION_DECL)
>  	e.modifier = "A";
>        else
> -	iasm_force_constraint ("X", &e);
> +	{
> +	  if (TARGET_64BIT)
> +	    e.modifier = "l";
> +	  iasm_force_constraint ("X", &e);
> +	}
>      }
>  #endif
>  
> @@ -8149,6 +8185,9 @@
>  #ifndef IASM_VALID_PIC
>  #define IASM_VALID_PIC(D,E)
>  #endif
> +#ifndef IASM_RIP
> +#define IASM_RIP(X)
> +#endif
>  
>  /* Force the last operand to have constraint C.  */
>  
> @@ -8240,6 +8279,10 @@
>  	 :-( Hope this stays working.  */
>        iasm_force_constraint ("X", e);
>        modifier = "l";
> +#ifdef TARGET_386
> +      if (TARGET_64BIT)
> +	modifier = "a";
> +#endif
>        if (e->modifier)
>  	{
>  	  modifier = e->modifier;
> @@ -8355,6 +8398,7 @@
>  	      sprintf (buf + strlen (buf), "%s", user_label_prefix);
>  	      strcat (buf, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (arg)));
>  	    }
> +	  IASM_RIP (buf);
>  
>  	  mark_decl_referenced (arg);
>  	}
> 
> Modified: llvm-gcc-4.2/trunk/gcc/c-common.h
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-common.h?rev=62478&r1=62477&r2=62478&view=diff
> 
> ==============================================================================
> --- llvm-gcc-4.2/trunk/gcc/c-common.h (original)
> +++ llvm-gcc-4.2/trunk/gcc/c-common.h Sun Jan 18 20:22:40 2009
> @@ -461,6 +461,11 @@
>  
>  extern int warn_unknown_pragmas; /* Tri state variable.  */
>  
> +/* Warn about format/argument anomalies in calls to formatted I/O functions
> +   (*printf, *scanf, strftime, strfmon, etc.).  */
> +
> +extern int warn_format;
> +
>  /* APPLE LOCAL begin disable_typechecking_for_spec_flag */
>  /* This makes type conflicts a warning, instead of an error,
>     to work around some problems with SPEC.  */
> @@ -1156,8 +1161,6 @@
>    tree block_original_ref_decl_list;
>    /* APPLE LOCAL radar 5847213 - tree block_original_byref_decl_list is removed. */
>    tree block_body;
> -  bool hasPrototype;
> -  bool isVariadic;
>    bool BlockHasCopyDispose;
>    /* APPLE LOCAL radar 6214617 */
>    bool BlockImportsCxxObjects;
> 
> Modified: llvm-gcc-4.2/trunk/gcc/c-parser.c
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-parser.c?rev=62478&r1=62477&r2=62478&view=diff
> 
> ==============================================================================
> --- llvm-gcc-4.2/trunk/gcc/c-parser.c (original)
> +++ llvm-gcc-4.2/trunk/gcc/c-parser.c Sun Jan 18 20:22:40 2009
> @@ -95,9 +95,6 @@
>  #define IDENTIFIER 2
>  /* APPLE LOCAL end CW asm blocks (in 4.2 g) */
>  
> -/* APPLE LOCAL radar 6185344 */
> -static int parsing_block_return_type;
> -
>  /* The reserved keyword table.  */
>  struct resword
>  {
> @@ -1077,6 +1074,10 @@
>    C_DTR_NORMAL,
>    /* An abstract declarator (maybe empty).  */
>    C_DTR_ABSTRACT,
> +  /* APPLE LOCAL begin blocks 6339747 */
> +  /* A block declarator (maybe empty).  */
> +  C_DTR_BLOCK,
> +  /* APPLE LOCAL end blocks 6339747 */
>    /* A parameter declarator: may be either, but after a type name does
>       not redeclare a typedef name as an identifier if it can
>       alternatively be interpreted as a typedef name; see DR#009,
> @@ -2500,6 +2501,18 @@
>       parameter-list ;
>       parameter-forward-declarations parameter-list ;
>  
> +     APPLE LOCAL begin blocks 6339747
> +   block-declarator:
> +     pointer
> +     pointer[opt] direct-block-declarator
> +
> +   direct-block-declarator:
> +     ( attributes[opt] block-declarator )
> +     direct-block-declarator[opt] array-declarator
> +     direct-block-declarator[opt]
> +       ( parameter-type-list[opt] ) [opt]
> +     APPLE LOCAL end blocks 6339747
> +
>     The uses of attributes shown above are GNU extensions.
>  
>     Some forms of array declarator are not included in C99 in the
> @@ -2586,7 +2599,8 @@
>       ??? Also following the old parser, typedef names may be
>       redeclared in declarators, but not Objective-C class names.  */
>  
> -  if (kind != C_DTR_ABSTRACT
> +  /* APPLE LOCAL blocks 6339747 */
> +  if ((kind != C_DTR_ABSTRACT && kind != C_DTR_BLOCK)
>        && c_parser_next_token_is (parser, CPP_NAME)
>        && ((type_seen_p
>  	   /* APPLE LOCAL begin radar 4281748 */
> @@ -2613,8 +2627,7 @@
>    /* Either we are at the end of an abstract declarator, or we have
>       parentheses.  */
>  
> -  /* APPLE LOCAL radar 6185344 */
> -  if (!parsing_block_return_type && c_parser_next_token_is (parser, CPP_OPEN_PAREN))
> +  if (c_parser_next_token_is (parser, CPP_OPEN_PAREN))
>      {
>        tree attrs;
>        struct c_declarator *inner;
> @@ -5474,7 +5487,7 @@
>  			     assignment-expression )
>       __builtin_types_compatible_p ( type-name , type-name )
>       APPLE LOCAL blocks (C++ cf)
> -     ^ block-literal-expr
> +     block-literal-expr
>  
>     offsetof-member-designator:
>       identifier
> @@ -9662,11 +9675,11 @@
>  	      rest_of_decl_compilation (NSConcreteGlobalBlock_decl, 0, 0);
>  	    }
>  	}
> -      /* LLVM LOCAL begin radar 5865221 */
> +      /* APPLE LOCAL begin radar 6457359 */
>        initlist = build_tree_list (fields,
>                                    convert (ptr_type_node,
>                                             build_fold_addr_expr (NSConcreteGlobalBlock_decl)));
> -      /* LLVM LOCAL end radar 5865221 */
> +      /* APPLE LOCAL end radar 6457359 */
>        flags |= BLOCK_IS_GLOBAL;
>      }
>    else
> @@ -9686,11 +9699,11 @@
>  	      rest_of_decl_compilation (NSConcreteStackBlock_decl, 0, 0);
>  	    }
>  	}
> -      /* LLVM LOCAL begin radar 5865221 */
> +      /* APPLE LOCAL begin radar 6457359 */
>        initlist = build_tree_list (fields,
>                                    convert (ptr_type_node,
>                                             build_fold_addr_expr (NSConcreteStackBlock_decl)));
> -      /* LLVM LOCAL end radar 5865221 */
> +      /* APPLE LOCAL end radar 6457359 */
>      }
>    fields = TREE_CHAIN (fields);
>  
> @@ -9713,11 +9726,11 @@
>    fields = TREE_CHAIN (fields);
>  
>    /* __descriptor */
> -  /* LLVM LOCAL begin radar 5865221 */
> +  /* APPLE LOCAL begin radar 6457359 */
>    initlist = tree_cons (fields,
> -			build_fold_addr_expr (descriptor_block_decl),
> -			initlist);
> -  /* LLVM LOCAL end radar 5865221 */
> +                        build_fold_addr_expr (descriptor_block_decl),
> +                        initlist);
> +  /* APPLE LOCAL end radar 6457359 */
>    for (chain = block_impl->block_original_ref_decl_list; chain;
>         chain = TREE_CHAIN (chain))
>      {
> @@ -10025,11 +10038,49 @@
>    free (arg_info);
>  }
>  
> -/** c_parser_block_literal_expr - Main routine to process a block literal
> -    with the syntax of ^arg-list[OPT] block or ^()expression. It synthesizes
> -    the helper function for later generation and builds the necessary data to
> -    represent the block literal where it is declared.
> -*/
> +/* Parse a block-id.
> +
> +   GNU Extension:
> +
> +   block-id:
> +     specifier-qualifier-list block-declarator
> +
> +   Returns the DECL specified or implied.  */
> +
> +static tree
> +c_parser_block_id (c_parser* parser)
> +{
> +  struct c_declspecs *specs = build_null_declspecs ();
> +  struct c_declarator *declarator;
> +  bool dummy = false;
> +
> +  c_parser_declspecs (parser, specs, false, true, true);
> +  if (!specs->declspecs_seen_p)
> +    {
> +      c_parser_error (parser, "expected specifier-qualifier-list");
> +      return NULL;
> +    }
> +  pending_xref_error ();
> +  finish_declspecs (specs);
> +  declarator = c_parser_declarator (parser, specs->type_seen_p,
> +				    C_DTR_BLOCK, &dummy);
> +  if (declarator == NULL)
> +    return NULL;
> +
> +  return grokblockdecl (specs, declarator);
> +}
> +
> +/* Parse a block-literal-expr.
> +
> +   GNU Extension:
> +
> +  block-literal-expr:
> +    ^ parameter-declation-clause exception-specification [opt] compound-statement
> +    ^ block-id compound-statement
> +
> +    It synthesizes the helper function for later generation and builds
> +    the necessary data to represent the block literal where it is
> +    declared.  */
>  static tree
>  c_parser_block_literal_expr (c_parser* parser)
>  {
> @@ -10037,7 +10088,7 @@
>    static int global_unique_count;
>    int unique_count = ++global_unique_count;
>    tree block_helper_function_decl;
> -  tree expr, body, type, arglist, ftype;
> +  tree expr, body, type, arglist = void_list_node, ftype;
>    tree self_arg, stmt;
>    struct c_arg_info *args = NULL;
>    tree arg_type = void_list_node;
> @@ -10060,40 +10111,19 @@
>      attributes = c_parser_attributes (parser);
>    /* APPLE LOCAL end radar 6237713 */
>    
> -  /* APPLE LOCAL begin radar 6185344 */
> -  /* Parse user declared return type. */
> -  if (!c_parser_next_token_is (parser, CPP_OPEN_PAREN) &&
> -      !c_parser_next_token_is (parser, CPP_OPEN_BRACE))
> -  {
> -    struct c_type_name *type;
> -    /* APPLE LOCAL begin radar 6237713 */
> -    if (attributes)
> -      {
> -        warning (0, "attribute before block type is ignored");
> -        attributes = NULL_TREE;
> -      }
> -    /* APPLE LOCAL end radar 6237713 */
> -    parsing_block_return_type = 1;
> -    type = c_parser_type_name (parser);
> -    parsing_block_return_type = 0;
> -    if (type) {
> -      declared_block_return_type = groktypename (type);
> -    }
> -  }
> -  /* APPLE LOCAL end radar 6185344 */
> -
> -  /* Parse the optional argument list */
>    if (c_parser_next_token_is (parser, CPP_OPEN_PAREN))
>      {
> +      /* Parse the optional argument list */
>        c_parser_consume_token (parser);
>        /* Open the scope to collect parameter decls */
>        push_scope ();
>        args = c_parser_parms_declarator (parser, true, NULL_TREE);
>        /* Check for args as it might be NULL due to error. */
> -      if (args) {
> -	arglist = args->parms;
> -	arg_type = args->types;
> -      }
> +      if (args)
> +	{
> +	  arglist = args->parms;
> +	  arg_type = args->types;
> +	}
>        else
>  	{
>  	  pop_scope ();
> @@ -10102,8 +10132,28 @@
>        open_paren_seen = true;
>        pop_scope ();
>      }
> -  else
> -    arglist = build_tree_list (NULL_TREE, void_type_node);
> +  else if (c_parser_next_token_is_not (parser, CPP_OPEN_BRACE))
> +    {
> +      /* Parse user declared return type. */
> +      tree decl;
> +    
> +      /* APPLE LOCAL begin radar 6237713 */
> +      if (attributes)
> +	{
> +	  warning (0, "attributes before block type are ignored");
> +	  attributes = NULL_TREE;
> +	}
> +      /* APPLE LOCAL end radar 6237713 */    
> +
> +      decl = c_parser_block_id (parser);
> +
> +      if (decl && decl != error_mark_node)
> +	{
> +	  arg_type = TYPE_ARG_TYPES (TREE_TYPE (decl));
> +	  arglist = DECL_ARGUMENTS (decl);
> +	  declared_block_return_type = TREE_TYPE (TREE_TYPE (decl));
> +	}
> +    }
>  
>    block = begin_block ();
>  
> @@ -10117,36 +10167,22 @@
>      cur_block->return_type = NULL_TREE;
>  
>    if (args)
> -    {
> -      tree list = NULL_TREE;
> -      cur_block->arg_info = args;
> -      if (arg_type)
> -	{
> -	  cur_block->hasPrototype = true;
> -	  /* This is the only way in gcc to know if argument list ends with ... */
> -	  for (list = arg_type; TREE_CHAIN (list); list = TREE_CHAIN (list))
> -	    ;
> -	  cur_block->isVariadic = (list != void_list_node);
> -	}
> -      else
> -	{
> -	  /* K&R syle () argument list. */
> -	  cur_block->hasPrototype = false;
> -	  cur_block->isVariadic = true;
> -	}
> -    }
> +    cur_block->arg_info = args;
>    else
> +    cur_block->arg_info = xcalloc (1, sizeof (struct c_arg_info));
> +
> +  if (declared_block_return_type)
>      {
> -      cur_block->hasPrototype = false;
> -      cur_block->isVariadic = false;
> -      cur_block->arg_info = xcalloc (1, sizeof (struct c_arg_info));
> +      cur_block->arg_info->parms = arglist;
> +      cur_block->arg_info->types = arg_type;
>      }
>  
> -  /* Must also build hidden parameter _self added to the helper
> +  /* Must also build hidden parameter .block_descriptor added to the helper
>     function, even though we do not know its type yet. */
> -  self_arg = build_decl (PARM_DECL, get_identifier ("_self"),
> +  /* APPLE LOCAL radar 6404979 */
> +  self_arg = build_decl (PARM_DECL, get_identifier (".block_descriptor"),
>                           ptr_type_node);
> -  TREE_USED (self_arg) = 1;  /* Prevent unused parameter '_self' warning. */
> +  TREE_USED (self_arg) = 1;  /* Prevent unused parameter '.block_descriptor' warning. */
>    TREE_CHAIN (self_arg) = cur_block->arg_info->parms;
>    cur_block->arg_info->types = tree_cons (NULL_TREE, ptr_type_node, arg_type);
>    cur_block->arg_info->parms = self_arg;
> @@ -10161,8 +10197,8 @@
>                                  ? void_type_node : cur_block->return_type),
>                                 cur_block->arg_info->types);
>    /* APPLE LOCAL end radar 6185344 */
> -  /* APPLE LOCAL radar 6160536 */
> -  block_helper_function_decl = build_helper_func_decl (build_block_helper_name (unique_count),
> +  /* APPLE LOCAL radar 6160536 - radar 6411649 */
> +  block_helper_function_decl = build_helper_func_decl (build_block_helper_name (0),
>                                                           ftype);
>    DECL_CONTEXT (block_helper_function_decl) = current_function_decl;
>    cur_block->helper_func_decl = block_helper_function_decl;
> @@ -10241,7 +10277,7 @@
>    if (restype == error_mark_node)
>      return clean_and_exit (block);
>  
> -  /* Now that we know type of the hidden _self argument, fix its type. */
> +  /* Now that we know type of the hidden .block_descriptor argument, fix its type. */
>    TREE_TYPE (self_arg) = cur_block->block_arg_ptr_type;
>    DECL_ARG_TYPE (self_arg) = cur_block->block_arg_ptr_type;
>  
> 
> Modified: llvm-gcc-4.2/trunk/gcc/c.opt
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c.opt?rev=62478&r1=62477&r2=62478&view=diff
> 
> ==============================================================================
> --- llvm-gcc-4.2/trunk/gcc/c.opt (original)
> +++ llvm-gcc-4.2/trunk/gcc/c.opt Sun Jan 18 20:22:40 2009
> @@ -225,8 +225,8 @@
>  Warn if testing floating point numbers for equality
>  
>  Wformat
> -C ObjC C++ ObjC++ Var(warn_format) Warning
> -Warn about format strings
> +C ObjC C++ ObjC++
> +Warn about printf/scanf/strftime/strfmon format string anomalies
>  
>  Wformat-extra-args
>  C ObjC C++ ObjC++ Var(warn_format_extra_args)
> @@ -236,9 +236,11 @@
>  C ObjC C++ ObjC++ Var(warn_format_nonliteral)
>  Warn about format strings that are not literals
>  
> +; APPLE LOCAL begin default to Wformat-security 5764921
>  Wformat-security
> -C ObjC C++ ObjC++ Var(warn_format_security)
> +C ObjC C++ ObjC++ Var(warn_format_security) Init(1)
>  Warn about possible security problems with format functions
> +; APPLE LOCAL end default to Wformat-security 5764921
>  
>  Wformat-y2k
>  C ObjC C++ ObjC++ Var(warn_format_y2k)
> 
> Modified: llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h?rev=62478&r1=62477&r2=62478&view=diff
> 
> ==============================================================================
> --- llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h (original)
> +++ llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h Sun Jan 18 20:22:40 2009
> @@ -101,9 +101,6 @@
>    %{!mmacosx-version-min=*: %{!miphoneos-version-min=*: %(darwin_cc1_minversion)}} \
>    "/* APPLE LOCAL ignore -mcpu=G4 -mcpu=G5 */"\
>    %<faltivec %<mno-fused-madd %<mlong-branch %<mlongcall %<mcpu=G4 %<mcpu=G5 \
> -  "/* APPLE LOCAL enable format security warnings */"\
> -  %{!Wno-format:-Wformat} \
> -  %{!Wno-format-security:-Wformat-security} \
>    %{g: %{!fno-eliminate-unused-debug-symbols: -feliminate-unused-debug-symbols }}"
>  
>  /* APPLE LOCAL AltiVec */
> @@ -113,7 +110,7 @@
>  #undef ASM_SPEC
>  /* APPLE LOCAL begin kext weak_import 5935650 */
>  #define ASM_SPEC "-arch %(darwin_arch) -force_cpusubtype_ALL \
> -  %{mkernel|static|fapple-kext:%{!Zdynamic:-static}}"
> +  %{mkernel|static|fapple-kext:%{!m64:-static}}"
>  /* APPLE LOCAL end kext weak_import 5935650 */
>  
>  #define DARWIN_ARCH_SPEC "%{m64:x86_64;:i386}"
> @@ -373,9 +370,11 @@
>  /* APPLE LOCAL begin CW asm blocks */
>  #define IASM_VALID_PIC(DECL, E)						\
>    do {									\
> -    if (E->as_immediate && ! MACHO_DYNAMIC_NO_PIC_P && flag_pic)	\
> +    if (! TARGET_64BIT							\
> +	&& E->as_immediate && ! MACHO_DYNAMIC_NO_PIC_P && flag_pic)	\
>        warning (0, "non-pic addressing form not suitible for pic code");	\
>    } while (0)
> +#define IASM_RIP(X) do { if (TARGET_64BIT) strcat (X, "(%%rip)"); } while (0)
>  /* APPLE LOCAL end cw asm blocks */
>  
>  /* APPLE LOCAL KEXT */
> 
> Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin.h
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin.h?rev=62478&r1=62477&r2=62478&view=diff
> 
> ==============================================================================
> --- llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin.h (original)
> +++ llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin.h Sun Jan 18 20:22:40 2009
> @@ -113,9 +113,6 @@
>    %{static: %{Zdynamic: %e conflicting code gen style switches are used}}\
>    "/* APPLE LOCAL ARM 5683689 */"\
>    %{!mmacosx-version-min=*: %{!miphoneos-version-min=*: %(darwin_cc1_minversion)}} \
> -  "/* APPLE LOCAL enable format security warnings */"\
> -  %{!Wno-format:-Wformat} \
> -  %{!Wno-format-security:-Wformat-security} \
>    "/* APPLE LOCAL -fast or -fastf or -fastcp */"\
>    %{!mkernel:%{!static:%{!fast:%{!fastf:%{!fastcp:%{!mdynamic-no-pic:-fPIC}}}}}}"
>  
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 




More information about the llvm-commits mailing list