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

Rafael Espindola rafael.espindola at gmail.com
Fri Dec 5 03:41:28 PST 2008


Author: rafael
Date: Fri Dec  5 05:41:15 2008
New Revision: 60589

URL: http://llvm.org/viewvc/llvm-project?rev=60589&view=rev
Log:
Fix bug 2843. -Wformat-security is the default for darwin but not linux.

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.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=60589&r1=60588&r2=60589&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-common.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-common.c Fri Dec  5 05:41:15 2008
@@ -294,12 +294,6 @@
 
 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;
-
 /* 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.  */

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=60589&r1=60588&r2=60589&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-common.h (original)
+++ llvm-gcc-4.2/trunk/gcc/c-common.h Fri Dec  5 05:41:15 2008
@@ -461,11 +461,6 @@
 
 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.  */

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=60589&r1=60588&r2=60589&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c.opt (original)
+++ llvm-gcc-4.2/trunk/gcc/c.opt Fri Dec  5 05:41:15 2008
@@ -225,8 +225,8 @@
 Warn if testing floating point numbers for equality
 
 Wformat
-C ObjC C++ ObjC++
-Warn about printf/scanf/strftime/strfmon format string anomalies
+C ObjC C++ ObjC++ Var(warn_format) Warning
+Warn about format strings
 
 Wformat-extra-args
 C ObjC C++ ObjC++ Var(warn_format_extra_args)
@@ -236,11 +236,9 @@
 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) Init(1)
+C ObjC C++ ObjC++ Var(warn_format_security)
 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=60589&r1=60588&r2=60589&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h Fri Dec  5 05:41:15 2008
@@ -101,6 +101,9 @@
   %{!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 */

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=60589&r1=60588&r2=60589&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin.h Fri Dec  5 05:41:15 2008
@@ -113,6 +113,9 @@
   %{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}}}}}}"
 





More information about the llvm-commits mailing list