[llvm-commits] [llvm-gcc-4.2] r55654 - in /llvm-gcc-4.2/trunk/gcc: cfg.c cp/cvt.c cp/pt.c crtstuff.c doc/invoke.texi gcc.c gcov.c ipa-inline.c opts.c
Bill Wendling
isanbard at gmail.com
Tue Sep 2 14:43:04 PDT 2008
Author: void
Date: Tue Sep 2 16:43:04 2008
New Revision: 55654
URL: http://llvm.org/viewvc/llvm-project?rev=55654&view=rev
Log:
Default to Wformat-security
Modified:
llvm-gcc-4.2/trunk/gcc/cfg.c
llvm-gcc-4.2/trunk/gcc/cp/cvt.c
llvm-gcc-4.2/trunk/gcc/cp/pt.c
llvm-gcc-4.2/trunk/gcc/crtstuff.c
llvm-gcc-4.2/trunk/gcc/doc/invoke.texi
llvm-gcc-4.2/trunk/gcc/gcc.c
llvm-gcc-4.2/trunk/gcc/gcov.c
llvm-gcc-4.2/trunk/gcc/ipa-inline.c
llvm-gcc-4.2/trunk/gcc/opts.c
Modified: llvm-gcc-4.2/trunk/gcc/cfg.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cfg.c?rev=55654&r1=55653&r2=55654&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cfg.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cfg.c Tue Sep 2 16:43:04 2008
@@ -830,7 +830,8 @@
else
fprintf (file, ", ");
first = false;
- fprintf (file, bb_bitnames[i]);
+ /* APPLE LOCAL default to Wformat-security 5764921 */
+ fprintf (file, "%s", bb_bitnames[i]);
}
if (!first)
fprintf (file, ")");
Modified: llvm-gcc-4.2/trunk/gcc/cp/cvt.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/cvt.c?rev=55654&r1=55653&r2=55654&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/cvt.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/cvt.c Tue Sep 2 16:43:04 2008
@@ -640,7 +640,8 @@
if ((invalid_conv_diag
= targetm.invalid_conversion (TREE_TYPE (expr), type)))
{
- error (invalid_conv_diag);
+ /* APPLE LOCAL default to Wformat-security 5764921 */
+ error (invalid_conv_diag, "");
return error_mark_node;
}
Modified: llvm-gcc-4.2/trunk/gcc/cp/pt.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/pt.c?rev=55654&r1=55653&r2=55654&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/pt.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/pt.c Tue Sep 2 16:43:04 2008
@@ -6702,7 +6702,7 @@
SET_DECL_ASSEMBLER_NAME (r, NULL_TREE);
/* LLVM LOCAL begin */
#ifndef ENABLE_LLVM
- SET_DECL_RTL (r, NULL_RTX);
+ SET_DECL_RTL (r, NULL_RTX);
#else
SET_DECL_LLVM (r, 0);
#endif
@@ -8971,7 +8971,8 @@
/*template_arg_p=*/false,
&error_msg);
if (error_msg)
- error (error_msg);
+ /* APPLE LOCAL default to Wformat-security 5764921 */
+ error ("%s", error_msg);
if (!function_p && TREE_CODE (decl) == IDENTIFIER_NODE)
decl = unqualified_name_lookup_error (decl);
return decl;
Modified: llvm-gcc-4.2/trunk/gcc/crtstuff.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/crtstuff.c?rev=55654&r1=55653&r2=55654&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/crtstuff.c (original)
+++ llvm-gcc-4.2/trunk/gcc/crtstuff.c Tue Sep 2 16:43:04 2008
@@ -192,7 +192,7 @@
#ifdef __llvm__
__attribute__ ((__used__, section(".ctors"), aligned(sizeof(func_ptr))))
#else
- __attribute__ ((__unused__, section(".ctors"), aligned(sizeof(func_ptr))))
+ __attribute__ ((__unused__, section(".ctors"), aligned(sizeof(func_ptr))))
#endif
/* LLVM LOCAL end */
= { (func_ptr) (-1) };
@@ -529,7 +529,7 @@
/* FIXME: Remove when external weak linkage will be alive. */
__attribute__((__used__, section(".dtors"), aligned(sizeof(func_ptr))))
#else
- __attribute__((unused, section(".dtors"), aligned(sizeof(func_ptr))))
+ __attribute__((unused, section(".dtors"), aligned(sizeof(func_ptr))))
#endif
/* LLVM LOCAL end */
= { (func_ptr) 0 };
Modified: llvm-gcc-4.2/trunk/gcc/doc/invoke.texi
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/doc/invoke.texi?rev=55654&r1=55653&r2=55654&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/doc/invoke.texi (original)
+++ llvm-gcc-4.2/trunk/gcc/doc/invoke.texi Tue Sep 2 16:43:04 2008
@@ -282,9 +282,11 @@
-Wconversion -Wno-deprecated-declarations @gol
-Wdisabled-optimization -Wno-div-by-zero -Wno-endif-labels @gol
-Werror -Werror=* -Werror-implicit-function-declaration @gol
--Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
+ at c APPLE LOCAL default to Wformat-security 5764921
+-Wfatal-errors -Wfloat-equal -Wno-format -Wformat=2 @gol
-Wno-format-extra-args -Wformat-nonliteral @gol
--Wformat-security -Wformat-y2k @gol
+ at c APPLE LOCAL default to Wformat-security 5764921
+-Wno-format-security -Wformat-y2k @gol
-Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
-Wimport -Wno-import -Winit-self -Winline @gol
-Wno-int-to-pointer-cast @gol
@@ -2437,33 +2439,43 @@
@item -fobjc-gc
@opindex fobjc-gc
Enable garbage collection (GC) in Objective-C and Objective-C++ programs.
- at c APPLE LOCAL begin ObjC GC
-The resulting binary requires additional runtime support which is not
-present in any released version of Mac OS X.
-
-When the @option{-fobjc-gc} switch is specified, the compiler will replace
-assignments to instance variables (ivars) and to certain kinds of pointers to
-Objective-C object instances with calls to interceptor functions provided
-by the runtime garbage collector. Two type qualifiers, @code{__strong} and
- at code{__weak}, also become available. The @code{__strong} qualifier may be
-used to indicate that assignments to variables of this type should generate
-a GC interceptor call, e.g.:
+ at c APPLE LOCAL begin radar 5780114 - ObjC GC
+The resulting binary requires additional runtime support which is present on
+Mac OS X Version 10.5 (Leopard) and later. All Objective-C objects are presumed
+to be garbage collected. To aid in this effort, compiler implements assignments
+of Objective-C object pointers via runtime support functions. These functions work
+correctly in non-GC environments as well, in case this code is used as part of a
+library. Assignments of objects into instance variables of other objects are
+intercepted, so are assignments to global object variables. In general, assignments
+through pointers to objects are intercepted. Additionally, assignments of objects
+as fields within structures are intercepted.
+
+In addition, other pointer variables may be marked with the __strong storage class
+modifier to indicate to the compiler that these assignments need to use the assignment
+runtime functions as well, allowing the memory referenced by these pointers to be
+allocated from the collector. A __weak storage class modifier for pointers is also
+introduced to indicate a zero-ing weak reference. This is permitted only for instance
+variables of an object or globals. The compiler arranges for all reads as well as
+writes to these variables to occur via runtime support functions. Under garbage
+collection these variables are not consulted when determining what is not garbage
+and they are set to nil (zero) if the memory they reference is deemed garbage and is
+collected.
@smallexample
- __strong void *p; // assignments to 'p' will have interceptor calls
+ __strong void *p; // assignments to 'p' will have runtime support calls
int *q; // assignments to 'q' ordinarly will not
@dots{}
- (__strong int *)q = 0; // this assignment will call an interceptor
+ (__strong int *)q = 0; // this assignment will call a runtime support function
@end smallexample
-Conversely, the @code{__weak} type qualifier may be used to suppress
-interceptor call generation:
+Conversely, the @code{__weak} type qualifier may be used to call weak runtime
+functions.
@smallexample
- __weak id q; // assignments to 'q' will not have interceptor calls
- id p; // assignments to 'p' will have interceptor calls
+ __weak id q; // assignments to 'q' will have the '__weak' semantics
+ id p; // assignments to 'p' will have the "__strong' semantics
@dots{}
- (__weak id)p = 0; // suppress interceptor call for this assignment
+ (__weak id)p = 0; // Fall back to '__weak' semantics in this assignment.
@end smallexample
@item -fobjc-gc-only
@@ -2473,7 +2485,7 @@
This flag implies @option{-fobjc-gc} as well. With this flag, framework
is marked as not honoring retain/release.
- at c APPLE LOCAL end ObjC GC
+ at c APPLE LOCAL end radar 5780114 - ObjC GC
@item -freplace-objc-classes
@opindex freplace-objc-classes
Emit a special marker instructing @command{ld(1)} not to statically link in
@@ -2746,8 +2758,10 @@
occurred rather than trying to keep going and printing further error
messages.
- at item -Wformat
- at opindex Wformat
+ at c APPLE LOCAL begin default to Wformat-security 5764921
+ at item -Wno-format
+ at opindex Wno-format
+ at c APPLE LOCAL end default to Wformat-security 5764921
@opindex ffreestanding
@opindex fno-builtin
Check calls to @code{printf} and @code{scanf}, etc., to make sure that
@@ -2812,8 +2826,10 @@
string literal and so cannot be checked, unless the format function
takes its format arguments as a @code{va_list}.
- at item -Wformat-security
- at opindex Wformat-security
+ at c APPLE LOCAL begin default to Wformat-security 5764921
+ at item -Wno-format-security
+ at opindex Wno-format-security
+ at c APPLE LOCAL end default to Wformat-security 5764921
If @option{-Wformat} is specified, also warn about uses of format
functions that represent possible security problems. At present, this
warns about calls to @code{printf} and @code{scanf} functions where the
@@ -3618,8 +3634,6 @@
@item -Wshorten-64-to-32
@opindex Wshorten-64-to-32
Warn if a value is implicitly converted from a 64 bit type to a 32 bit type.
-This option is deprecated in favor of the -Wconversion option in future
-releases.
@c APPLE LOCAL end mainline
@c APPLE LOCAL begin mainline
Modified: llvm-gcc-4.2/trunk/gcc/gcc.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/gcc.c?rev=55654&r1=55653&r2=55654&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/gcc.c (original)
+++ llvm-gcc-4.2/trunk/gcc/gcc.c Tue Sep 2 16:43:04 2008
@@ -3054,7 +3054,8 @@
if (errmsg != NULL)
{
if (err == 0)
- fatal (errmsg);
+ /* APPLE LOCAL default to Wformat-security 5764921 */
+ fatal ("%s", errmsg);
else
{
errno = err;
@@ -6842,7 +6843,8 @@
if (! verbose_flag)
{
- printf (_("\nFor bug reporting instructions, please see:\n"));
+ /* APPLE LOCAL default to Wformat-security 5764921 */
+ printf ("%s", _("\nFor bug reporting instructions, please see:\n"));
printf ("%s.\n", bug_report_url);
return (0);
Modified: llvm-gcc-4.2/trunk/gcc/gcov.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/gcov.c?rev=55654&r1=55653&r2=55654&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/gcov.c (original)
+++ llvm-gcc-4.2/trunk/gcc/gcov.c Tue Sep 2 16:43:04 2008
@@ -417,7 +417,8 @@
fnotice (stdout, "gcov (GCC) %s\n", version_string);
fprintf (stdout, "Copyright %s 2006 Free Software Foundation, Inc.\n",
_("(C)"));
- fnotice (stdout,
+ /* APPLE LOCAL default to Wformat-security 5764921 */
+ fnotice (stdout, "%s",
_("This is free software; see the source for copying conditions.\n"
"There is NO warranty; not even for MERCHANTABILITY or \n"
"FITNESS FOR A PARTICULAR PURPOSE.\n\n"));
Modified: llvm-gcc-4.2/trunk/gcc/ipa-inline.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ipa-inline.c?rev=55654&r1=55653&r2=55654&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/ipa-inline.c (original)
+++ llvm-gcc-4.2/trunk/gcc/ipa-inline.c Tue Sep 2 16:43:04 2008
@@ -310,7 +310,8 @@
if (!DECL_STRUCT_FUNCTION (decl)->cfg)
{
if (reason)
- *reason = N_("function body not available");
+ /* APPLE LOCAL wording 4598393 */
+ *reason = N_("the function body must appear before caller");
return false;
}
@@ -1088,7 +1089,8 @@
if (altivec_infection (node->callers))
{
if (dump_file)
- fprintf (dump_file, node->callers->inline_failed);
+ /* APPLE LOCAL default to Wformat-security 5764921 */
+ fprintf (dump_file, "%s", node->callers->inline_failed);
continue;
}
/* APPLE LOCAL end Selective inlining of functions that use Altivec 3837835 */
Modified: llvm-gcc-4.2/trunk/gcc/opts.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/opts.c?rev=55654&r1=55653&r2=55654&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/opts.c (original)
+++ llvm-gcc-4.2/trunk/gcc/opts.c Tue Sep 2 16:43:04 2008
@@ -1379,7 +1379,8 @@
for (i = 0; i < cl_options_count; i++)
if ((cl_options[i].flags & (CL_TARGET | CL_UNDOCUMENTED)) == CL_TARGET)
{
- printf (_("\nTarget specific options:\n"));
+ /* APPLE LOCAL default to Wformat-security 5764921 */
+ printf ("%s", _("\nTarget specific options:\n"));
print_filtered_help (CL_TARGET);
break;
}
More information about the llvm-commits
mailing list