* device/include/hc08/mc68hc908jkjl.h: committed fix for bug #1929739, thanks Alejand...
[fw/sdcc] / support / cpp2 / sdcpp.h
index 06fccfd3152b7f29308be611efbc923ea26b062b..296db1bf0fae9d53479a6a7490cca06abf5fc74d 100644 (file)
@@ -2,6 +2,8 @@
 #define __SDCPP_H
 
 #ifdef _WIN32
+/* declaration of alloca */
+#include <malloc.h>
 #include <string.h>
 #ifdef __BORLANDC__
 #define strcasecmp  stricmp
 #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
  */
@@ -35,17 +21,17 @@ typedef long long long_long;
 #endif
 
 /* Define results of standard character escape sequences.  */
-#define TARGET_BELL    007
-#define TARGET_BS      010
-#define TARGET_TAB     011
-#define TARGET_NEWLINE 012
-#define TARGET_VT      013
-#define TARGET_FF      014
-#define TARGET_CR      015
-#define TARGET_ESC     033
+#define TARGET_BELL     007
+#define TARGET_BS       010
+#define TARGET_TAB      011
+#define TARGET_NEWLINE  012
+#define TARGET_VT       013
+#define TARGET_FF       014
+#define TARGET_CR       015
+#define TARGET_ESC      033
 
 #define CHAR_TYPE_SIZE 8
-#define WCHAR_TYPE_SIZE 32     /* ? maybe ? */
+#define WCHAR_TYPE_SIZE 32      /* ? maybe ? */
 
 #define SUPPORTS_ONE_ONLY 0
 
@@ -67,10 +53,6 @@ struct lang_hooks
      the language mask to filter the switch array with.  */
   unsigned int (*init_options) (unsigned int argc, const char **argv);
 
-  /* Callback used to perform language-specific initialization for the
-     global diagnostic context structure.  */
-  void (*initialize_diagnostics) (struct diagnostic_context *);
-
   /* Handle the switch CODE, which has real type enum opt_code from
      options.h.  If the switch takes an argument, it is passed in ARG
      which points to permanent storage.  The handler is responsible for
@@ -103,9 +85,6 @@ struct lang_hooks
 
   /* Called at the end of compilation, as a finalizer.  */
   void (*finish) (void);
-
-  /* Called by report_error_function to print out function name.  */
-  void (*print_error_function) (struct diagnostic_context *, const char *);
 };
 
 /* Each front end provides its own.  */
@@ -114,38 +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;
-extern void warning0 (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
 /* 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 pedwarn (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
-extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
-extern void inform (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
-extern void verbatim (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
-
-#ifdef BUFSIZ
-  /* N.B. Unlike all the others, fnotice is just gettext+fprintf, and
-     therefore it can have ATTRIBUTE_PRINTF.  */
-extern void fnotice                    (FILE *, const char *, ...)
-     ATTRIBUTE_PRINTF_2;
-#endif
+extern void inform (const char *, ...) ATTRIBUTE_PRINTF_1;
 
 extern bool exit_after_options;
 
@@ -158,7 +113,7 @@ extern void decode_d_option (const char *);
    compilation was started.  */
 
 extern const char *get_src_pwd (void);
-extern bool set_src_pwd        (const char *);
+extern bool set_src_pwd (const char *);
 
 /*
  * From flags.h
@@ -242,10 +197,18 @@ extern void pp_dir_change (cpp_reader *, const char *);
 extern struct cpp_reader* parse_in;
 
 /*
- * From tree.h
+ * From input.h
  */
-#include "input.h"
+extern struct line_maps line_table;
+
+typedef source_location location_t; /* deprecated typedef */
+
+/* Top-level source file.  */
+extern const char *main_input_filename;
 
+/*
+ * From tree.h
+ */
 /* Define the overall contents of a tree node.
    just to make diagnostic.c happy  */
 
@@ -259,4 +222,10 @@ union tree_node
 
 #define DECL_SOURCE_LOCATION(NODE) ((NODE)->decl.locus)
 
+/*
+ * From diagnostic.h
+ */
+extern int errorcount;
+
+
 #endif  /* __SDCPP_H */