From c63ee7996ec0850a927ffbdc628a5438061d3c32 Mon Sep 17 00:00:00 2001 From: borutr Date: Wed, 10 Jan 2007 19:12:06 +0000 Subject: [PATCH] * suppoprt/cpp2/Makefile.bcc: reenable Borland C compilation * suppoprt/cpp2/configure.in, suppoprt/cpp2/libcpp/lex.c, suppoprt/cpp2/Makefile.in, suppoprt/cpp2/sdcpp-opts, suppoprt/cpp2/sdcpp.[ch]: house cleaning git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4569 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 4 ++ support/cpp2/Makefile.bcc | 86 +++++++++++++++++++++++++++++---------- support/cpp2/Makefile.in | 4 +- support/cpp2/configure.in | 13 ------ support/cpp2/libcpp/lex.c | 1 - support/cpp2/sdcpp-opts.c | 3 -- support/cpp2/sdcpp.c | 2 +- support/cpp2/sdcpp.h | 41 ++++--------------- 8 files changed, 79 insertions(+), 75 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7408fd8e..ce4d8b92 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,10 @@ * src/SDCC.lex, src/SDCCmain.c: fixed bug #1631895: codeseg/constseg #pragma fail + * suppoprt/cpp2/Makefile.bcc: reenable Borland C compilation + * suppoprt/cpp2/configure.in, suppoprt/cpp2/libcpp/lex.c, + suppoprt/cpp2/Makefile.in, suppoprt/cpp2/sdcpp-opts, + suppoprt/cpp2/sdcpp.[ch]: house cleaning 2007-01-09 Borut Razem diff --git a/support/cpp2/Makefile.bcc b/support/cpp2/Makefile.bcc index d4a92111..fcdd33a6 100644 --- a/support/cpp2/Makefile.bcc +++ b/support/cpp2/Makefile.bcc @@ -4,38 +4,82 @@ PRJDIR = ../.. !include $(PRJDIR)/Bcc.inc -CFLAGS = $(CFLAGS) -I. -I./libiberty -DHAVE_CONFIG_H +CFLAGS = $(CFLAGS) -I. -I./libiberty -I./libcpp -I./libcpp/include -DHAVE_CONFIG_H +AWK = gawk -OBJECTS = sdcpp.obj cppinit.obj \ - cpplib.obj cpplex.obj cppmacro.obj cppexp.obj \ - cppfiles.obj cpphash.obj cpperror.obj cppdefault.obj \ - hashtable.obj mkdeps.obj prefix.obj version.obj \ - line-map.obj cpptrad.obj \ - sdcpp-opts.obj cppcharset.obj hashtab.obj c-incpath.obj c-ppoutput.obj opts.obj options.obj diagnostic.obj pretty-print.obj \ - safe-ctype.obj obstack.obj splay-tree.obj lbasename.obj \ - hex.obj concat.obj \ - xmalloc.obj xstrdup.obj xexit.obj xmemdup.obj xstrerror.obj getpwd.obj vasprintf.obj +LIBCPP_OBJS = charset.obj directives.obj errors.obj expr.obj files.obj identifiers.obj \ + init.obj lex.obj line-map.obj macro.obj mkdeps.obj symtab.obj traditional.obj -TARGET = $(PRJDIR)/bin/sdcpp.exe +LIBIBERTY_OBJS = concat.obj fopen_unlocked.obj getpwd.obj hashtab.obj hex.obj \ + lbasename.obj md5.obj obstack.obj safe-ctype.obj splay-tree.obj \ + vasprintf.obj xexit.obj xmalloc.obj xmemdup.obj xstrdup.obj \ + xstrerror.obj + +SDCC_OBJS = sdcpp.obj sdcpp-opts.obj c-ppoutput.obj cppdefault.obj prefix.obj \ + version.obj opts.obj options.obj c-incpath.obj + +OBJECTS = $(SDCC_OBJS) $(LIBCPP_OBJS) $(LIBIBERTY_OBJS) + +TARGET = $(PRJDIR)/bin/sdcpp.exe all: $(TARGET) auto-host.h: auto-host_vc_in.h copy auto-host_vc_in.h auto-host.h > nul -$(TARGET): auto-host.h $(OBJECTS) - $(CC) $(CFLAGS) -e$(TARGET) $(OBJECTS) +########################## +# Libcpp -safe-ctype.obj: libiberty\safe-ctype.c +charset.obj: libcpp\charset.c +directives.obj: libcpp\directives.c +errors.obj: libcpp\errors.c +expr.obj: libcpp\expr.c +files.obj: libcpp\files.c +identifiers.obj: libcpp\identifiers.c +init.obj: libcpp\init.c +lex.obj: libcpp\lex.c +line-map.obj: libcpp\line-map.c +macro.obj: libcpp\macro.c +mkdeps.obj: libcpp\mkdeps.c +symtab.obj: libcpp\symtab.c +traditional.obj: libcpp\traditional.c + +########################## +# Libiberty + +concat.obj: libiberty\concat.c +fopen_unlocked.obj: libiberty\fopen_unlocked.c +getpwd.obj: libiberty\getpwd.c +hashtab.obj: libiberty\hashtab.c +hex.obj: libiberty\hex.c +lbasename.obj: libiberty\lbasename.c +md5.obj: libiberty\md5.c obstack.obj: libiberty\obstack.c +safe-ctype.obj: libiberty\safe-ctype.c splay-tree.obj: libiberty\splay-tree.c -lbasename.obj: libiberty\lbasename.c -hex.obj: libiberty\hex.c -concat.obj: libiberty\concat.c -xmalloc.obj: libiberty\xmalloc.c -xstrdup.obj: libiberty\xstrdup.c +vasprintf.obj: libiberty\vasprintf.c xexit.obj: libiberty\xexit.c +xmalloc.obj: libiberty\xmalloc.c xmemdup.obj: libiberty\xmemdup.c +xstrdup.obj: libiberty\xstrdup.c xstrerror.obj: libiberty\xstrerror.c -getpwd.obj: libiberty\getpwd.c -vasprintf.obj: libiberty\vasprintf.c \ No newline at end of file + +########################## +# Sdcpp + +$(TARGET): auto-host.h $(OBJECTS) + $(CC) $(CFLAGS) -e$(TARGET) $(OBJECTS) + +optionlist.tmp: + $(AWK) -f opt-gather.awk sdcpp.opt > optionlist.tmp + +options.c: optionlist.tmp + $(AWK) -f opt-functions.awk -f optc-gen.awk -v header_name="config.h system.h options.h" optionlist.tmp > options.c + +options.h: optionlist.tmp + $(AWK) -f opt-functions.awk -f opth-gen.awk optionlist.tmp > options.h + +sdcpp.obj: sdcpp.c options.h +sdcpp-opts.obj: sdcpp-opts.c options.h +options.obj: options.c options.h +opts.obj: opts.c options.h diff --git a/support/cpp2/Makefile.in b/support/cpp2/Makefile.in index 2c72bfd8..e05013f2 100644 --- a/support/cpp2/Makefile.in +++ b/support/cpp2/Makefile.in @@ -36,7 +36,7 @@ srcdir = @srcdir@ LIBS = @LIBS@ -CFLAGS = @CFLAGS@ +CFLAGS = @CFLAGS@ -Wall ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) \ $(CFLAGS) $(WARN_CFLAGS) $(XCFLAGS) @DEFS@ ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS) @@ -127,7 +127,7 @@ clean: distclean: clean -rm -f auto-host.h auto-build.h cstamp-h Makefile - -rm -f configargs.h config.status config.run config.cache config.bak config.log *~ + config.status config.run config.cache config.bak config.log *~ # This tells GNU Make version 3 not to put all variables in the environment. .NOEXPORT: diff --git a/support/cpp2/configure.in b/support/cpp2/configure.in index 8f47d09d..4532c6bd 100644 --- a/support/cpp2/configure.in +++ b/support/cpp2/configure.in @@ -333,19 +333,6 @@ changequote(,)dnl gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*"\([^"]*\)".*/\1/'` gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'` -# Compile in configure arguments. -if test -f configargs.h ; then - # Being re-configured. - gcc_config_arguments=`grep configuration_arguments configargs.h | sed -e 's/.*"\([^"]*\)".*/\1/'` - gcc_config_arguments="$gcc_config_arguments : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS" -else - gcc_config_arguments="$TOPLEVEL_CONFIGURE_ARGUMENTS" -fi -cat > configargs.h <buffer->cur - 1); struct obstack *stack = &pfile->hash_table->stack; - cpp_buffer *buffer = pfile->buffer; int len = 0; int has_whole = 0; int has_fract = 0; diff --git a/support/cpp2/sdcpp-opts.c b/support/cpp2/sdcpp-opts.c index 19bc2649..e4eea8c8 100644 --- a/support/cpp2/sdcpp-opts.c +++ b/support/cpp2/sdcpp-opts.c @@ -36,8 +36,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA # define TARGET_SYSTEM_ROOT NULL #endif -static int saved_lineno; - /* CPP's options. */ static cpp_options *cpp_opts; @@ -192,7 +190,6 @@ sdcpp_common_init_options (unsigned int argc, const char **argv ATTRIBUTE_UNUSED int sdcpp_common_handle_option (size_t scode, const char *arg, int value) { - const struct cl_option *option = &cl_options[scode]; enum opt_code code = (enum opt_code) scode; int result = 1; diff --git a/support/cpp2/sdcpp.c b/support/cpp2/sdcpp.c index b508ea64..e45a02f0 100644 --- a/support/cpp2/sdcpp.c +++ b/support/cpp2/sdcpp.c @@ -436,7 +436,7 @@ do_compile (void) It is not safe to call this function more than once. */ int -main (unsigned int argc, const char **argv) +main (int argc, const char **argv) { /* Initialization of SDCPP's environment. */ general_init (argv[0]); diff --git a/support/cpp2/sdcpp.h b/support/cpp2/sdcpp.h index fa6ae679..296db1bf 100644 --- a/support/cpp2/sdcpp.h +++ b/support/cpp2/sdcpp.h @@ -2,6 +2,8 @@ #define __SDCPP_H #ifdef _WIN32 +/* declaration of alloca */ +#include #include #ifdef __BORLANDC__ #define strcasecmp stricmp @@ -11,22 +13,6 @@ #endif #define BYTES_BIG_ENDIAN 0 -#if defined _MSC_VER || defined __MINGW32__ || defined __BORLANDC__ -/* - * The following define causes the following warning: - * warning: `I' flag used with `%x' printf format - * when copiled with mingw or cygwin -mno-cygwin gcc. - * This is correct, because the mingw compilation links against msvcrt.dll, - * which uses "I46" for 64 bit integer (long long) printf lenght modifier, - * instead of "ll" used by libc. - */ -#define PRINTF_INT64_MODIFIER "I64" -typedef __int64 long_long; -#else -#define PRINTF_INT64_MODIFIER "ll" -typedef long long long_long; -#endif - /* * From defaults.h */ @@ -107,27 +93,14 @@ extern const struct lang_hooks lang_hooks; /* * From toplev.h */ -/* If we haven't already defined a frontend specific diagnostics - style, use the generic one. */ -#ifndef GCC_DIAG_STYLE -#define GCC_DIAG_STYLE __gcc_diag__ -#endif -/* None of these functions are suitable for ATTRIBUTE_PRINTF, because - each language front end can extend them with its own set of format - specifiers. We must use custom format checks. */ -#if GCC_VERSION >= 4001 -#define ATTRIBUTE_GCC_DIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m) -#else -#define ATTRIBUTE_GCC_DIAG(m, n) ATTRIBUTE_NONNULL(m) -#endif -extern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2) +extern void internal_error (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; /* Pass one of the OPT_W* from options.h as the first parameter. */ -extern void warning (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); -extern void error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); -extern void fatal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2) +extern void warning (int, const char *, ...) ATTRIBUTE_PRINTF_2; +extern void error (const char *, ...) ATTRIBUTE_PRINTF_1; +extern void fatal_error (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; -extern void inform (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); +extern void inform (const char *, ...) ATTRIBUTE_PRINTF_1; extern bool exit_after_options; -- 2.47.2