Make a new XPIDL_WARNING macro to generalize the check against using IDL_tree_warning when compiled against libIDL 0.6.5.

This commit is contained in:
mccabe%netscape.com 1999-08-22 01:10:14 +00:00
Родитель f8cb6fb0c7
Коммит 5746b51c9a
4 изменённых файлов: 58 добавлений и 42 удалений

Просмотреть файл

@ -37,6 +37,25 @@
#include <IDL.h>
#endif
/*
* IDL_tree_warning bombs on libIDL version 6.5, and I don't want to not write
* warnings... so I define a versioned one here. Thanks to Mike Shaver for the
* ## idiom, which allows us to pass through varargs calls.
*/
#if !(LIBIDL_MAJOR_VERSION == 0 && LIBIDL_MINOR_VERSION == 6 && \
LIBIDL_MICRO_VERSION == 5)
/*
* This turns a varargs call to XPIDL_WARNING directly into a varargs call to
* IDL_tree_warning. The only tricky bit is that you must call XPIDL_WARNING
* with extra parens, e.g. XPIDL_WARNING((foo, bar, "sil"))
*
* Probably best removed when we leave 6.5.
*/
#define XPIDL_WARNING(x) IDL_tree_warning##x
#else
#define XPIDL_WARNING(x) do { } while (0)
#endif
/*
* Internal operation flags.
*/

Просмотреть файл

@ -221,16 +221,12 @@ interface(TreeState *state)
continue;
case IDLN_CODEFRAG:
/* IDL_tree_warning crashes in libIDL 0.6.5, sometimes */
#if !(LIBIDL_MAJOR_VERSION == 0 && LIBIDL_MINOR_VERSION == 6 && \
LIBIDL_MICRO_VERSION == 5)
IDL_tree_warning(iter, IDL_WARNING1,
"%%{ .. %%} code fragment within interface "
"ignored when generating NS_DECL_IFOO macro; "
"if the code fragment contains method "
"declarations, the macro probably isn't "
"complete.");
#endif
XPIDL_WARNING((iter, IDL_WARNING1,
"%%{ .. %%} code fragment within interface "
"ignored when generating NS_DECL_IFOO macro; "
"if the code fragment contains method "
"declarations, the macro probably isn't "
"complete."));
continue;
default:
@ -476,9 +472,9 @@ attr_dcl(TreeState *state)
static gboolean
do_enum(TreeState *state)
{
IDL_tree_warning(state->tree, IDL_WARNING1,
"enums not supported, enum \'%s\' ignored",
IDL_IDENT(IDL_TYPE_ENUM(state->tree).ident).str);
XPIDL_WARNING((state->tree, IDL_WARNING1,
"enums not supported, enum \'%s\' ignored",
IDL_IDENT(IDL_TYPE_ENUM(state->tree).ident).str));
return TRUE;
#if 0
IDL_tree enumb = state->tree, iter;
@ -509,9 +505,9 @@ do_const_dcl(TreeState *state)
if (!IDL_NODE_UP(IDL_NODE_UP(state->tree)) ||
IDL_NODE_TYPE(IDL_NODE_UP(IDL_NODE_UP(state->tree)))
!= IDLN_INTERFACE) {
IDL_tree_warning(state->tree, IDL_WARNING1,
"const decl \'%s\' not inside interface, ignored",
name);
XPIDL_WARNING((state->tree, IDL_WARNING1,
"const decl \'%s\' not inside interface, ignored",
name));
return TRUE;
}
@ -530,8 +526,9 @@ do_const_dcl(TreeState *state)
fprintf(state->file, "\n enum { %s = %d };\n",
name, (int) IDL_INTEGER(dcl->const_exp).value);
} else {
IDL_tree_warning(state->tree, IDL_WARNING1,
"const decl \'%s\' was not of type short or long, ignored", name);
XPIDL_WARNING((state->tree, IDL_WARNING1,
"const decl \'%s\' was not of type "
"short or long, ignored", name));
}
return TRUE;
}
@ -544,8 +541,8 @@ do_typedef(TreeState *state)
complex;
if (IDL_NODE_TYPE(type) == IDLN_TYPE_SEQUENCE) {
IDL_tree_warning(state->tree, IDL_WARNING1,
"sequences not supported, ignored");
XPIDL_WARNING((state->tree, IDL_WARNING1,
"sequences not supported, ignored"));
} else {
state->tree = type;
fputs("typedef ", state->file);
@ -741,9 +738,9 @@ codefrag(TreeState *state)
{
char *desc = IDL_CODEFRAG(state->tree).desc;
if (strcmp(desc, "C++")) {
IDL_tree_warning(state->tree, IDL_WARNING1,
"ignoring '%%{%s' escape. "
"(Use '%%{C++' to escape verbatim code.)", desc);
XPIDL_WARNING((state->tree, IDL_WARNING1,
"ignoring '%%{%s' escape. "
"(Use '%%{C++' to escape verbatim code.)", desc));
return TRUE;
}

Просмотреть файл

@ -564,9 +564,9 @@ constant_declaration(TreeState *state)
IDL_NODE_TYPE(IDL_NODE_UP(IDL_NODE_UP(state->tree))) !=
IDLN_INTERFACE) {
IDL_tree_warning(state->tree, IDL_WARNING1,
"A constant \"%s\" was declared outside an interface."
" It was ignored.", name);
XPIDL_WARNING((state->tree, IDL_WARNING1,
"A constant \"%s\" was declared outside an interface."
" It was ignored.", name));
return TRUE;
}
@ -614,9 +614,9 @@ constant_declaration(TreeState *state)
(isshort ? "short" : "int"),
name, (int) IDL_INTEGER(declaration->const_exp).value);
} else {
IDL_tree_warning(state->tree, IDL_WARNING1,
"A constant \"%s\" was not of type short or long."
" It was ignored.", name);
XPIDL_WARNING((state->tree, IDL_WARNING1,
"A constant \"%s\" was not of type short or long."
" It was ignored.", name));
}
return TRUE;
@ -699,9 +699,9 @@ attribute_declaration(TreeState *state)
static gboolean
enum_declaration(TreeState *state)
{
IDL_tree_warning(state->tree, IDL_WARNING1,
"enums not supported, enum \'%s\' ignored",
IDL_IDENT(IDL_TYPE_ENUM(state->tree).ident).str);
XPIDL_WARNING((state->tree, IDL_WARNING1,
"enums not supported, enum \'%s\' ignored",
IDL_IDENT(IDL_TYPE_ENUM(state->tree).ident).str));
return TRUE;
}

Просмотреть файл

@ -933,9 +933,9 @@ typelib_const_dcl(TreeState *state)
if (!IDL_NODE_UP(IDL_NODE_UP(state->tree)) ||
IDL_NODE_TYPE(IDL_NODE_UP(IDL_NODE_UP(state->tree)))
!= IDLN_INTERFACE) {
IDL_tree_warning(state->tree, IDL_WARNING1,
"const decl \'%s\' not inside interface, ignored",
name);
XPIDL_WARNING((state->tree, IDL_WARNING1,
"const decl \'%s\' not inside interface, ignored",
name));
return TRUE;
}
@ -987,8 +987,8 @@ typelib_const_dcl(TreeState *state)
}
NEXT_CONST(state)++;
} else {
IDL_tree_warning(state->tree, IDL_WARNING1,
"const decl \'%s\' was not of type short or long, ignored", name);
XPIDL_WARNING((state->tree, IDL_WARNING1,
"const decl \'%s\' was not of type short or long, ignored", name));
}
return TRUE;
@ -1000,8 +1000,8 @@ typelib_const_dcl(TreeState *state)
/* const -> list -> interface */
if (IDL_NODE_TYPE(IDL_NODE_UP(IDL_NODE_UP(state->tree)))
!= IDLN_INTERFACE) {
IDL_tree_warning(state->tree, IDL_WARNING1,
"const decl not inside interface!\n");
XPIDL_WARNING((state->tree, IDL_WARNING1,
"const decl not inside interface!\n"));
return TRUE;
}
@ -1088,9 +1088,9 @@ typelib_const_dcl(TreeState *state)
static gboolean
typelib_enum(TreeState *state)
{
IDL_tree_warning(state->tree, IDL_WARNING1,
"enums not supported, enum \'%s\' ignored",
IDL_IDENT(IDL_TYPE_ENUM(state->tree).ident).str);
XPIDL_WARNING((state->tree, IDL_WARNING1,
"enums not supported, enum \'%s\' ignored",
IDL_IDENT(IDL_TYPE_ENUM(state->tree).ident).str));
return TRUE;
}