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
This commit is contained in:
Mike Stump 2007-03-06 00:48:47 +00:00 committed by Mike Stump
parent 2011412786
commit 1f1d513061
14 changed files with 130 additions and 8 deletions

View File

@ -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

View File

@ -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"

View File

@ -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;

View File

@ -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;

View File

@ -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 */

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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)))
{

View File

@ -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"

View File

@ -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 */

View File

@ -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"

View File

@ -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);