aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2007-03-06 00:48:47 +0000
committerMike Stump <mrs@gcc.gnu.org>2007-03-06 00:48:47 +0000
commit1f1d51306154bf6a354ff988868d3183022011c0 (patch)
tree926625ccb9f896a1998fbb4c463fe5a2b9ccaf39
parent201141278667c89ad246224f65e70764e58e819f (diff)
downloadgcc-1f1d51306154bf6a354ff988868d3183022011c0.zip
gcc-1f1d51306154bf6a354ff988868d3183022011c0.tar.gz
gcc-1f1d51306154bf6a354ff988868d3183022011c0.tar.bz2
c-common.c (targetcm): Add.
* c-common.c (targetcm): Add. * c-opts.c (c_common_handle_option): Handle language specific target options. * opts.c (handle_option): Verify language for target options, if any are given. * opth-gen.awk: Add CL_LANG_ALL. * target-def.h (TARGET_HANDLE_C_OPTION): Add. (TARGETCM_INITIALIZER): Add. * target.h (struct gcc_targetcm): Add. (targetcm): Add. * targhooks.c (default_handle_c_option): Add. * targhooks.h (default_handle_c_option): Add. * doc/tm.texi (TARGET_HANDLE_C_OPTION): Add. * config/darwin.opt (iframework): Add. * config/darwin.h (TARGET_HAS_TARGETCM): Add. * config/darwin-c.c (handle_c_option): Add. (TARGET_HANDLE_C_OPTION): Add. (targetcm): Add. * doc/invoke.texi (Darwin Options): Add -iframework. From-SVN: r122590
-rw-r--r--gcc/ChangeLog23
-rw-r--r--gcc/c-common.c5
-rw-r--r--gcc/c-opts.c8
-rw-r--r--gcc/config/darwin-c.c40
-rw-r--r--gcc/config/darwin.h2
-rw-r--r--gcc/config/darwin.opt4
-rw-r--r--gcc/doc/invoke.texi9
-rw-r--r--gcc/doc/tm.texi13
-rw-r--r--gcc/opth-gen.awk1
-rw-r--r--gcc/opts.c9
-rw-r--r--gcc/target-def.h3
-rw-r--r--gcc/target.h12
-rw-r--r--gcc/targhooks.c8
-rw-r--r--gcc/targhooks.h1
14 files changed, 130 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f6a9af9..7ebd9d3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,26 @@
+2007-03-05 Mike Stump <mrs@apple.com>
+
+ * c-common.c (targetcm): Add.
+ * c-opts.c (c_common_handle_option): Handle language specific
+ target options.
+ * opts.c (handle_option): Verify language for target options, if
+ any are given.
+ * opth-gen.awk: Add CL_LANG_ALL.
+ * target-def.h (TARGET_HANDLE_C_OPTION): Add.
+ (TARGETCM_INITIALIZER): Add.
+ * target.h (struct gcc_targetcm): Add.
+ (targetcm): Add.
+ * targhooks.c (default_handle_c_option): Add.
+ * targhooks.h (default_handle_c_option): Add.
+ * doc/tm.texi (TARGET_HANDLE_C_OPTION): Add.
+
+ * config/darwin.opt (iframework): Add.
+ * config/darwin.h (TARGET_HAS_TARGETCM): Add.
+ * config/darwin-c.c (handle_c_option): Add.
+ (TARGET_HANDLE_C_OPTION): Add.
+ (targetcm): Add.
+ * doc/invoke.texi (Darwin Options): Add -iframework.
+
2007-03-05 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* convert.c (convert_to_integer): Fix nearbyint/rint -> *lrint
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 523ef46..1a35af7 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -48,6 +48,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "opts.h"
#include "real.h"
#include "cgraph.h"
+#include "target-def.h"
cpp_reader *parse_in; /* Declared in c-pragma.h. */
@@ -6926,4 +6927,8 @@ c_build_cdtor_fns (void)
}
}
+#ifndef TARGET_HAS_TARGETCM
+struct gcc_targetcm targetcm = TARGETCM_INITIALIZER;
+#endif
+
#include "gt-c-common.h"
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index 11dcf0a..bddbaad 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -39,6 +39,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "opts.h"
#include "options.h"
#include "mkdeps.h"
+#include "target.h"
#ifndef DOLLARS_IN_IDENTIFIERS
# define DOLLARS_IN_IDENTIFIERS true
@@ -278,7 +279,12 @@ c_common_handle_option (size_t scode, const char *arg, int value)
{
default:
if (cl_options[code].flags & (CL_C | CL_CXX | CL_ObjC | CL_ObjCXX))
- break;
+ {
+ if ((option->flags & CL_TARGET)
+ && ! targetcm.handle_c_option (scode, arg, value))
+ result = 0;
+ break;
+ }
#ifdef CL_Fortran
if (lang_fortran && (cl_options[code].flags & (CL_Fortran)))
break;
diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c
index eefd5f6..dc03a9d 100644
--- a/gcc/config/darwin-c.c
+++ b/gcc/config/darwin-c.c
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA. */
#include "tm_p.h"
#include "cppdefault.h"
#include "prefix.h"
+#include "target.h"
+#include "target-def.h"
/* Pragmas. */
@@ -42,13 +44,6 @@ Boston, MA 02110-1301, USA. */
static bool using_frameworks = false;
-/* Maintain a small stack of alignments. This is similar to pragma
- pack's stack, but simpler. */
-
-static void push_field_alignment (int);
-static void pop_field_alignment (void);
-static const char *find_subframework_file (const char *, const char *);
-static void add_system_framework_path (char *);
static const char *find_subframework_header (cpp_reader *pfile, const char *header,
cpp_dir **dirp);
@@ -60,6 +55,9 @@ typedef struct align_stack
static struct align_stack * field_align_stack = NULL;
+/* Maintain a small stack of alignments. This is similar to pragma
+ pack's stack, but simpler. */
+
static void
push_field_alignment (int bit_alignment)
{
@@ -619,3 +617,31 @@ darwin_cpp_builtins (cpp_reader *pfile)
builtin_define_with_value ("__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__",
version_as_macro(), false);
}
+
+/* Handle C family front-end options. */
+
+static bool
+handle_c_option (size_t code,
+ const char *arg,
+ int value ATTRIBUTE_UNUSED)
+{
+ switch (code)
+ {
+ default:
+ /* Unrecognized options that we said we'd handle turn into
+ errors if not listed here. */
+ return false;
+
+ case OPT_iframework:
+ add_system_framework_path (xstrdup (arg));
+ break;
+ }
+
+ /* We recognized the option. */
+ return true;
+}
+
+#undef TARGET_HANDLE_C_OPTION
+#define TARGET_HANDLE_C_OPTION handle_c_option
+
+struct gcc_targetcm targetcm = TARGETCM_INITIALIZER;
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index a1cc46c..3d93399 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -980,4 +980,6 @@ extern int flag_mkernel;
extern int flag_apple_kext;
#define TARGET_KEXTABI flag_apple_kext
+#define TARGET_HAS_TARGETCM 1
+
#endif /* CONFIG_DARWIN_H */
diff --git a/gcc/config/darwin.opt b/gcc/config/darwin.opt
index 28dd1c4..b27b3db 100644
--- a/gcc/config/darwin.opt
+++ b/gcc/config/darwin.opt
@@ -42,3 +42,7 @@ Generate code for darwin loadable kernel extensions
mkernel
Target Report Var(flag_mkernel)
Generate code for the kernel or loadable kernel extensions
+
+iframework
+Target RejectNegative C ObjC C++ ObjC++ Joined Separate
+-iframework <dir> Add <dir> to the end of the system framework include path
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 8541634..3d5c06c 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -462,6 +462,7 @@ Objective-C and Objective-C++ Dialects}.
-dynamic -dynamiclib -exported_symbols_list @gol
-filelist -flat_namespace -force_cpusubtype_ALL @gol
-force_flat_namespace -headerpad_max_install_names @gol
+-iframework @gol
-image_base -init -install_name -keep_private_externs @gol
-multi_module -multiply_defined -multiply_defined_unused @gol
-noall_load -no_dead_strip_inits_and_terms @gol
@@ -8463,6 +8464,14 @@ in @samp{"/System/Library/Frameworks"} and
the name of the framework and header.h is found in the
@samp{"PrivateHeaders"} or @samp{"Headers"} directory.
+@item -iframework@var{dir}
+@opindex iframework
+Like @option{-F} except the directory is a treated as a system
+directory. The main difference between this @option{-iframework} and
+@option{-F} is that with @option{-iframework} the compiler does not
+warn about constructs contained within header files found via
+@var{dir}. This option is valid only for the C family of languages.
+
@item -gused
@opindex -gused
Emit debugging information for symbols that are used. For STABS
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 2d9ef64..c5920d0 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -773,6 +773,19 @@ argument. Otherwise @var{value} is 1 if the positive form of the
option was used and 0 if the ``no-'' form was.
@end deftypefn
+@deftypefn {Target Hook} bool TARGET_HANDLE_C_OPTION (size_t @var{code}, const char *@var{arg}, int @var{value})
+This target hook is called whenever the user specifies one of the
+target-specific C language family options described by the @file{.opt}
+definition files(@pxref{Options}). It has the opportunity to do some
+option-specific processing and should return true if the option is
+valid. The default definition does nothing but return false.
+
+In general, you should use @code{TARGET_HANDLE_OPTION} to handle
+options. However, if processing an option requires routines that are
+only available in the C (and related language) front ends, then you
+should use @code{TARGET_HANDLE_C_OPTION} instead.
+@end deftypefn
+
@defmac TARGET_VERSION
This macro is a C statement to print on @code{stderr} a string
describing the particular machine description choice. Every machine
diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk
index e7ffc1a..97abcf0 100644
--- a/gcc/opth-gen.awk
+++ b/gcc/opth-gen.awk
@@ -139,6 +139,7 @@ for (i = 0; i < n_langs; i++) {
s = substr(" ", length (macros[i]))
print "#define " macros[i] s " (1 << " i ")"
}
+print "#define CL_LANG_ALL ((1 << " n_langs ") - 1)"
print ""
print "enum opt_code"
diff --git a/gcc/opts.c b/gcc/opts.c
index c84bc2a..d3aea98 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -268,6 +268,15 @@ handle_option (const char **argv, unsigned int lang_mask)
complain_wrong_lang (argv[0], option, lang_mask);
goto done;
}
+ else if ((option->flags & CL_TARGET)
+ && (option->flags & CL_LANG_ALL)
+ && !(option->flags & lang_mask))
+ {
+ /* Complain for target flag language mismatches if any languages
+ are specified. */
+ complain_wrong_lang (argv[0], option, lang_mask);
+ goto done;
+ }
if (arg == NULL && (option->flags & (CL_JOINED | CL_SEPARATE)))
{
diff --git a/gcc/target-def.h b/gcc/target-def.h
index c9d5180..fb9af5a 100644
--- a/gcc/target-def.h
+++ b/gcc/target-def.h
@@ -730,5 +730,8 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
TARGET_ARM_EABI_UNWINDER \
}
+#define TARGET_HANDLE_C_OPTION default_handle_c_option
+#define TARGETCM_INITIALIZER { TARGET_HANDLE_C_OPTION }
+
#include "hooks.h"
#include "targhooks.h"
diff --git a/gcc/target.h b/gcc/target.h
index d312c9f..029d183 100644
--- a/gcc/target.h
+++ b/gcc/target.h
@@ -892,4 +892,16 @@ struct gcc_target
extern struct gcc_target targetm;
+struct gcc_targetcm {
+ /* Handle target switch CODE (an OPT_* value). ARG is the argument
+ passed to the switch; it is NULL if no argument was. VALUE is the
+ value of ARG if CODE specifies a UInteger option, otherwise it is
+ 1 if the positive form of the switch was used and 0 if the negative
+ form was. Return true if the switch was valid. */
+ bool (*handle_c_option) (size_t code, const char *arg, int value);
+};
+
+/* Each target can provide their own. */
+extern struct gcc_targetcm targetcm;
+
#endif /* GCC_TARGET_H */
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index 982fcdb..f1e4637 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -614,4 +614,12 @@ default_narrow_bitfield (void)
return !STRICT_ALIGNMENT;
}
+bool
+default_handle_c_option (size_t code ATTRIBUTE_UNUSED,
+ const char *arg ATTRIBUTE_UNUSED,
+ int value ATTRIBUTE_UNUSED)
+{
+ return false;
+}
+
#include "gt-targhooks.h"
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index b6bd700..33b5348 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -82,3 +82,4 @@ extern enum reg_class default_secondary_reload (bool, rtx, enum reg_class,
enum machine_mode,
secondary_reload_info *);
extern void hook_void_bitmap (bitmap);
+extern bool default_handle_c_option (size_t, const char *, int);