Various warning fixes for .NET 2003 cl /W4 to work barring one warning and for gcc -ansi -Wall -pedantic to be warning free:

const fixes and function prototype declarations matching the definition etc


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5639 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2004-01-15 22:46:07 +00:00
commit 8377edf02a
24 changed files with 77 additions and 63 deletions

View file

@ -269,9 +269,10 @@ void start_inline(char *text, int line) {
* Inserts a comment into a documentation entry.
**************************************************************/
/*
void yycomment(char *a, int b, int c) {
}
*/
/* -----------------------------------------------------------------------------
* skip_balanced()

View file

@ -59,6 +59,7 @@ static int dirprot_mode = 0;
/* Called by the parser (yyparse) when an error is found.*/
static void yyerror (const char *e) {
(void)e;
}
static Node *new_node(const String_or_char *tag) {
@ -2970,7 +2971,7 @@ cpp_namespace_decl : NAMESPACE idcolon LBRACE {
| NAMESPACE LBRACE {
Hash *h;
$1 = Swig_symbol_current();
h = Swig_symbol_clookup("",0);
h = Swig_symbol_clookup((char *)"",0);
if (h && (Strcmp(nodeType(h),"namespace") == 0)) {
Swig_symbol_setscope(Getattr(h,"symtab"));
} else {
@ -4786,7 +4787,7 @@ stringnum : string {
$$ = $1;
}
| exprnum {
$$ = $1.val;
$$ = Char($1.val);
}
;

View file

@ -94,7 +94,7 @@ DohStr(const DOH *obj) {
if (objinfo->doh_str) {
return (objinfo->doh_str)(b);
}
sprintf(buffer,"<Object '%s' at %p>", objinfo->objname, b);
sprintf(buffer,"<Object '%s' at %p>", objinfo->objname, (void *)b);
return NewString(buffer);
} else {
return NewString(obj);

View file

@ -300,7 +300,7 @@ DohvPrintf(DOH *so, const char *format, va_list ap)
DohFree(stemp);
}
} else {
if (!doh) doh = "";
if (!doh) doh = (char *)"";
if (strlen(encoder)) {
DOH *s = NewString(doh);

View file

@ -139,7 +139,7 @@ DohObjFree(DOH *ptr) {
DohBase *b, *meta;
b = (DohBase *) ptr;
if (b->flag_intern) return;
meta = b->meta;
meta = (DohBase *)b->meta;
b->data = (void *) FreeList;
b->meta = 0;
b->type = 0;
@ -187,7 +187,7 @@ DohMemoryDebug(void) {
else if (p->ptr[i].type == &DohHashType) numhash++;
}
}
printf(" Pool %8p: size = %10d. used = %10d. free = %10d\n", p, p->len, nused, nfree);
printf(" Pool %8p: size = %10d. used = %10d. free = %10d\n", (void *)p, p->len, nused, nfree);
totsize += p->len;
totused+= nused;
totfree+= nfree;

View file

@ -520,6 +520,8 @@ end_quote(char *s)
static char *
match_simple(char *base, char *s, char *token, int tokenlen)
{
(void)base;
(void)tokenlen;
return strstr(s,token);
}
@ -561,6 +563,7 @@ match_identifier_begin(char *base, char *s, char *token, int tokenlen)
static char *
match_identifier_end(char *base, char *s, char *token, int tokenlen)
{
(void)base;
while (s) {
s = strstr(s,token);
if (!s) return 0;

View file

@ -650,6 +650,7 @@ public:
}
virtual int destructorDeclaration(Node *n) {
(void)n;
if (!inclass) return SWIG_OK;
if (!extendmode) {
Setattr(inclass,"allocate:has_destructor","1");

View file

@ -413,6 +413,9 @@ Swig_browser(Node *top, int port) {
swill_close();
delete browse;
return;
#else
(void)top;
(void)port;
#endif
}

View file

@ -3239,6 +3239,7 @@ class JAVA : public Language {
* classDirectorDisown()
* ------------------------------------------------------------------*/
virtual int classDirectorDisown(Node *n) {
(void)n;
return SWIG_OK;
}
@ -3272,7 +3273,7 @@ class JAVA : public Language {
* director-based class.
* ----------------------------------------------------------------------------- */
virtual int JAVA::abstractClassTest(Node *n) {
virtual int abstractClassTest(Node *n) {
if (!Cmp(Getattr(n, "feature:director"), "1"))
return 0;
return Language::abstractClassTest(n);

View file

@ -15,6 +15,7 @@
char cvsroot_lang_cxx[] = "$Header$";
#include "swigmod.h"
#include "cparse.h"
#include <ctype.h>
static int director_protected_mode = 0; /* set to 0 on default */
@ -519,6 +520,7 @@ int Language::insertDirective(Node *n) {
* ---------------------------------------------------------------------- */
int Language::moduleDirective(Node *n) {
(void)n;
/* %module directive */
return SWIG_OK;
}
@ -556,8 +558,6 @@ int Language::pragmaDirective(Node *n) {
* Language::typemapDirective()
* ---------------------------------------------------------------------- */
extern "C" void Swig_cparse_replace_descriptor(String *s);
int Language::typemapDirective(Node *n) {
/* %typemap directive */
String *method = Getattr(n,"method");
@ -1402,6 +1402,9 @@ int Language::typedefHandler(Node *) {
* ---------------------------------------------------------------------- */
int Language::classDirectorMethod(Node *n, Node *parent, String* super) {
(void)n;
(void)parent;
(void)super;
return SWIG_OK;
}
@ -1410,6 +1413,7 @@ int Language::classDirectorMethod(Node *n, Node *parent, String* super) {
* ---------------------------------------------------------------------- */
int Language::classDirectorConstructor(Node *n) {
(void)n;
return SWIG_OK;
}
@ -1418,6 +1422,7 @@ int Language::classDirectorConstructor(Node *n) {
* ---------------------------------------------------------------------- */
int Language::classDirectorDefaultConstructor(Node *n) {
(void)n;
return SWIG_OK;
}
@ -1564,6 +1569,7 @@ int Language::classDirectorMethods(Node *n) {
* ---------------------------------------------------------------------- */
int Language::classDirectorInit(Node *n) {
(void)n;
return SWIG_OK;
}
@ -1572,6 +1578,7 @@ int Language::classDirectorInit(Node *n) {
* ---------------------------------------------------------------------- */
int Language::classDirectorEnd(Node *n) {
(void)n;
return SWIG_OK;
}
@ -1776,6 +1783,7 @@ int Language::classHandler(Node *n) {
* ---------------------------------------------------------------------- */
int Language::classforwardDeclaration(Node *n) {
(void)n;
return SWIG_OK;
}
@ -2080,10 +2088,13 @@ int Language::functionWrapper(Node *n) {
* ----------------------------------------------------------------------------- */
int Language::nativeWrapper(Node *n) {
(void)n;
return SWIG_OK;
}
void Language::main(int argc, char *argv[]) {
(void)argc;
(void)argv;
}
/* -----------------------------------------------------------------------------

View file

@ -720,13 +720,11 @@ int SWIG_main(int argc, char *argv[], Language *l) {
}
Setattr(top,"outfile_h", NewStringf("%s_wrap.h", Swig_file_basename(input_file)));
} else {
char *header = strdup(outfile_name);
char *ext = header + strlen(header);
while (ext > header && *ext != '.') ext--;
if (*ext == '.') *ext = 0;
char *ext = strrchr(outfile_name, '.');
String *basename = ext ? NewStringWithSize(outfile_name,ext-outfile_name) : NewString(outfile_name);
Setattr(top,"outfile", outfile_name);
Setattr(top,"outfile_h", NewStringf("%s.h", header));
free(header);
Setattr(top,"outfile_h", NewStringf("%s.h", basename));
Delete(basename);
}
set_outdir(Swig_file_dirname(Getattr(top,"outfile")));
if (Swig_contract_mode_get()) {

View file

@ -70,10 +70,6 @@ static File *f_int_to_enum = 0;
class OCAML : public Language {
public:
int validIdentifier( String *s ) {
return true;
}
String *Swig_class_name(Node *n) {
String *name;
name = Copy(Getattr(n, "sym:name"));

View file

@ -949,7 +949,7 @@ public:
Putc(toupper((int )*iname), member_function_name);
Printf(member_function_name, "%s", iname+1);
cpp_func(Char(member_function_name), d, l, php_function_name);
cpp_func(l, php_function_name);
Delete(php_function_name);
Delete(member_function_name);
@ -1707,7 +1707,6 @@ public:
virtual int memberfunctionHandler(Node *n) {
char *name = GetChar(n, "name");
char *iname = GetChar(n, "sym:name");
SwigType *t = Getattr(n, "type");
ParmList *l = Getattr(n, "parms");
this->Language::memberfunctionHandler(n);
@ -1716,7 +1715,7 @@ public:
char *realname = iname ? iname : name;
String *php_function_name = Swig_name_member(shadow_classname, realname);
cpp_func(iname, t, l, realname, php_function_name);
cpp_func(l, realname, php_function_name);
}
return SWIG_OK;
@ -1752,7 +1751,7 @@ public:
static_flag = 1;
char *realname = iname ? iname : name;
String *php_function_name = Swig_name_member(shadow_classname, realname);
cpp_func(Char(symname), Getattr(n, "type"), Getattr(n, "parms"), symname, php_function_name);
cpp_func(Getattr(n, "parms"), symname, php_function_name);
static_flag = 0;
}
@ -1787,7 +1786,7 @@ public:
if(Getattr(n,"feature:immutable")) {
const_flag = 1;
}
cpp_func(iname, d, 0, iname);
cpp_func(0, iname);
static_flag = 0;
create_command(iname, Char(Swig_name_wrapper(iname)));
@ -2051,7 +2050,7 @@ public:
}
// This method is quite stale and ought to be factored out
void cpp_func(char *iname, SwigType *t, ParmList *l, String *php_function_name, String *handler_name = NULL) {
void cpp_func(ParmList *l, String *php_function_name, String *handler_name = NULL) {
if(!shadow) return;
// if they didn't provide a handler name, use the realname

View file

@ -234,7 +234,7 @@ public:
* add_method()
* ------------------------------------------------------------ */
void add_method(Node *n, const DOHString_or_char *name, const DOHString_or_char *function, const DOHString_or_char *description) {
void add_method(const DOHString_or_char *name, const DOHString_or_char *function, const DOHString_or_char *description) {
String *rename = NULL;
switch (current) {
case NO_CPP:
@ -468,7 +468,7 @@ public:
/* Now register the function with the interpreter. */
if (!Getattr(n,"sym:overloaded")) {
add_method(n, iname, wname, description);
add_method(iname, wname, description);
} else {
Setattr(n,"wrap:name", wname);
if (!Getattr(n,"sym:nextSibling")) {
@ -532,7 +532,7 @@ public:
if (pd)
Printf(description, " %s", pd);
}
add_method(n, symname, wname, description);
add_method(symname, wname, description);
Delete(description);
DelWrapper(f);
@ -597,7 +597,7 @@ public:
if (!addSymbol(wrapname,n)) return SWIG_ERROR;
add_method(n, name, wrapname,0);
add_method(name, wrapname,0);
return SWIG_OK;
}
@ -775,7 +775,7 @@ public:
/* Register it with Pike */
String *description = NewString("tStr tFloat, tVoid");
add_method(First(membervariables).item, "`->=", wname, description);
add_method("`->=", wname, description);
Delete(description);
/* Clean up */
@ -812,7 +812,7 @@ public:
/* Register it with Pike */
String *description = NewString("tStr, tMix");
add_method(First(membervariables).item, "`->", wname, description);
add_method("`->", wname, description);
Delete(description);
/* Clean up */

View file

@ -112,7 +112,7 @@ List *Preprocessor_depend(void) {
/* -----------------------------------------------------------------------------
* void Preprocessor_cpp_init() - Initialize the preprocessor
* ----------------------------------------------------------------------------- */
void Preprocessor_init() {
void Preprocessor_init(void) {
Hash *s;
cpp = NewHash();
s = NewHash();
@ -386,7 +386,7 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro)
*
* Undefines a macro.
* ----------------------------------------------------------------------------- */
void Preprocessor_undef(String_or_char *str)
void Preprocessor_undef(const String_or_char *str)
{
Hash *symbols;
assert(cpp);
@ -1343,7 +1343,7 @@ Preprocessor_parse(String *s)
Printf(ns,"%%importfile \"%s\" [\n", Swig_last_file());
/* See if the filename has a directory component */
dirname = Swig_file_dirname(Swig_last_file);
dirname = Swig_file_dirname(Swig_last_file());
if (!strlen(dirname)) dirname = 0;
if (dirname) {
dirname[strlen(dirname)-1] = 0; /* Kill trailing directory delimeter */

View file

@ -22,8 +22,8 @@ extern "C" {
extern int Preprocessor_expr(String *s, int *error);
extern char *Preprocessor_expr_error(void);
extern Hash *Preprocessor_define(const String_or_char *str, int swigmacro);
extern void Preprocessor_undef(String_or_char *name);
extern void Preprocessor_init();
extern void Preprocessor_undef(const String_or_char *name);
extern void Preprocessor_init(void);
extern String *Preprocessor_parse(String *s);
extern void Preprocessor_include_all(int);
extern void Preprocessor_import_all(int);

View file

@ -96,7 +96,7 @@ Swig_wrapped_var_type(SwigType *t) {
return ty;
}
String *
static String *
Swig_wrapped_var_deref(SwigType *t, String_or_char *name) {
if (SwigType_isclass(t)) {
return NewStringf("*%s",name);
@ -105,8 +105,8 @@ Swig_wrapped_var_deref(SwigType *t, String_or_char *name) {
}
}
String *
Swig_wrapped_var_assign(SwigType *t, String_or_char *name) {
static String *
Swig_wrapped_var_assign(SwigType *t, const String_or_char *name) {
if (SwigType_isclass(t)) {
return NewStringf("&%s",name);
} else {
@ -463,7 +463,7 @@ Swig_cmemberset_call(String_or_char *name, SwigType *type, String_or_char *self)
* ----------------------------------------------------------------------------- */
String *
Swig_cmemberget_call(String_or_char *name, SwigType *t, String_or_char *self) {
Swig_cmemberget_call(const String_or_char *name, SwigType *t, String_or_char *self) {
String *func;
if (!self) self = NewString("(this)->");
else self = NewString(self);

View file

@ -49,8 +49,10 @@ Swig_banner(File *f) {
* This file is not intended to be easily readable and contains a number of \n\
* coding conventions designed to improve portability and efficiency. Do not make\n\
* changes to this file unless you know what you are doing--modify the SWIG \n\
* interface file instead. \n\
* ----------------------------------------------------------------------------- */\n\n", PACKAGE_VERSION);
* interface file instead. \n", PACKAGE_VERSION);
/* String too long for ISO compliance */
Printf(f,
" * ----------------------------------------------------------------------------- */\n\n");
}

View file

@ -625,7 +625,7 @@ Swig_features_get(Hash *features, String *prefix, String *name, SwigType *decl,
* ----------------------------------------------------------------------------- */
void
Swig_feature_set(Hash *features, String *name, SwigType *decl, String *featurename, DOH *value) {
Swig_feature_set(Hash *features, const String_or_char *name, SwigType *decl, const String_or_char *featurename, String *value) {
Hash *n;
Hash *fhash;
/* Printf(stdout,"feature: %s %s %s %s\n", name, decl, featurename, value);*/

View file

@ -26,7 +26,7 @@ char cvsroot_parms_c[] = "$Header$";
* Create a new parameter from datatype 'type' and name 'n'.
* ------------------------------------------------------------------------ */
Parm *NewParm(SwigType *type, String_or_char *n) {
Parm *NewParm(SwigType *type, const String_or_char *n) {
Parm *p = NewHash();
if (type) {

View file

@ -247,7 +247,7 @@ extern String *SwigType_templateargs(SwigType *t);
extern String *SwigType_prefix(SwigType *t);
extern int SwigType_array_ndim(SwigType *t);
extern String *SwigType_array_getdim(SwigType *t, int n);
extern void SwigType_array_setdim(SwigType *t, int n, String_or_char *rep);
extern void SwigType_array_setdim(SwigType *t, int n, const String_or_char *rep);
extern SwigType *SwigType_array_type(SwigType *t);
extern String *SwigType_default(SwigType *t);
extern void SwigType_typename_replace(SwigType *t, String *pat, String *rep);
@ -261,7 +261,7 @@ extern void SwigType_inherit(String *subclass, String *baseclass, String
extern int SwigType_issubtype(SwigType *subtype, SwigType *basetype);
extern void SwigType_scope_alias(String *aliasname, Typetab *t);
extern void SwigType_using_scope(Typetab *t);
extern void SwigType_new_scope(String_or_char *name);
extern void SwigType_new_scope(const String_or_char *name);
extern void SwigType_inherit_scope(Typetab *scope);
extern Typetab *SwigType_pop_scope();
extern Typetab *SwigType_set_scope(Typetab *h);
@ -310,7 +310,7 @@ extern SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab);
/* Parameters are really just hidden behind a DOH object. The following
interface will probably be simplified even further. */
extern Parm *NewParm(SwigType *type, String_or_char *n);
extern Parm *NewParm(SwigType *type, const String_or_char *n);
extern Parm *CopyParm(Parm *p);
extern ParmList *CopyParmList(ParmList *);
extern int ParmList_len(ParmList *);
@ -396,7 +396,7 @@ extern void Swig_name_object_set(Hash *namehash, String_or_char *name, Swig
extern DOH *Swig_name_object_get(Hash *namehash, String_or_char *prefix, String_or_char *name, SwigType *decl);
extern void Swig_name_object_inherit(Hash *namehash, String *base, String *derived);
extern void Swig_features_get(Hash *features, String_or_char *prefix, String_or_char *name, SwigType *decl, Node *n);
extern void Swig_feature_set(Hash *features, String_or_char *name, SwigType *decl, String_or_char *fname, String *value);
extern void Swig_feature_set(Hash *features, const String_or_char *name, SwigType *decl, const String_or_char *featurename, String *value);
/* --- Misc --- */
extern char *Swig_copy_string(const char *c);
@ -430,8 +430,6 @@ extern void Swig_error_msg_format(ErrorMessageFormat format);
extern String *Swig_cparm_name(Parm *p, int i);
extern String *Swig_clocal(SwigType *t, String_or_char *name, String_or_char *value);
extern String *Swig_wrapped_var_type(SwigType *t);
extern String *Swig_wrapped_var_deref(SwigType *t, String_or_char *name);
extern String *Swig_wrapped_var_assign(SwigType *t, String_or_char *name);
extern int Swig_cargs(Wrapper *w, ParmList *l);
extern String *Swig_cresult(SwigType *t, const String_or_char *name, const String_or_char *decl);
@ -442,7 +440,7 @@ extern String *Swig_cppconstructor_call(String_or_char *name, ParmList *parms
extern String *Swig_cdestructor_call();
extern String *Swig_cppdestructor_call();
extern String *Swig_cmemberset_call(String_or_char *name, SwigType *type, String_or_char *self);
extern String *Swig_cmemberget_call(String_or_char *name, SwigType *t, String_or_char *self);
extern String *Swig_cmemberget_call(const String_or_char *name, SwigType *t, String_or_char *self);
/* --- Transformations --- */

View file

@ -15,7 +15,7 @@ char cvsroot_typemap_c[] = "$Header$";
#include "cparse.h"
#include <ctype.h>
static void replace_embedded_typemap(String *s, Wrapper *f);
static void replace_embedded_typemap(String *s);
/* -----------------------------------------------------------------------------
* Typemaps are stored in a collection of nested hash tables. Something like
@ -683,7 +683,7 @@ Swig_typemap_search_multi(const String_or_char *op, ParmList *parms, int *nmatch
* ----------------------------------------------------------------------------- */
static
void replace_local_types(ParmList *p, String *name, String *rep) {
void replace_local_types(ParmList *p, const String *name, const String *rep) {
SwigType *t;
while (p) {
t = Getattr(p,"type");
@ -1072,7 +1072,7 @@ String *Swig_typemap_lookup(const String_or_char *op, SwigType *type, String_or_
typemap_locals(s,locals,f,-1);
}
replace_embedded_typemap(s,f);
replace_embedded_typemap(s);
/* Now perform character replacements */
Replace(s,"$source",source,DOH_REPLACE_ANY);
@ -1150,7 +1150,7 @@ String *Swig_typemap_lookup_new(const String_or_char *op, Node *node, const Stri
if (locals && f) {
typemap_locals(s,locals,f,-1);
}
replace_embedded_typemap(s,f);
replace_embedded_typemap(s);
/* {
String *tmname = Getattr(tm,"typemap");
if (tmname) Replace(s,"$typemap",tmname, DOH_REPLACE_ANY);
@ -1348,7 +1348,7 @@ Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrapper *f)
typemap_locals(s,locals,f,argnum);
}
replace_embedded_typemap(s,f);
replace_embedded_typemap(s);
/* Replace the argument number */
sprintf(temp,"%d",argnum);
@ -1379,7 +1379,7 @@ Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrapper *f)
}
/* -----------------------------------------------------------------------------
* replace_embedded_typemap()
* split_embedded()
*
* This function replaces the special variable $typemap(....) with typemap
* code. The general form of $typemap is as follows:
@ -1462,7 +1462,7 @@ static void split_var(String *s, String **name, String **value) {
}
}
static void replace_embedded_typemap(String *s, Wrapper *f) {
static void replace_embedded_typemap(String *s) {
while (Strstr(s,"$TYPEMAP(")) {
/* Gather the argument */

View file

@ -453,7 +453,7 @@ void
SwigType_del_qualifier(SwigType *t) {
char *c = Char(t);
assert(strncmp(c,"q(",2) == 0);
Delslice(t,0,element_size(t));
Delslice(t,0,element_size(Char(t)));
}
int
@ -586,7 +586,7 @@ SwigType_array_getdim(SwigType *t, int n) {
}
/* Replace nth array dimension */
void SwigType_array_setdim(SwigType *t, int n, String_or_char *rep) {
void SwigType_array_setdim(SwigType *t, int n, const String_or_char *rep) {
String *result = 0;
char temp;
char *start;

View file

@ -207,7 +207,7 @@ SwigType_scope_name(Typetab *ttab) {
* Creates a new scope
* ----------------------------------------------------------------------------- */
void SwigType_new_scope(String_or_char *name) {
void SwigType_new_scope(const String_or_char *name) {
Typetab *s;
Hash *ttab;
String *qname;
@ -1653,7 +1653,7 @@ SwigType_emit_type_table(File *f_forward, File *f_table) {
while (ki.key) {
List *el;
Iterator ei;
String *cd;
const String *cd;
Printf(f_forward,"#define SWIGTYPE%s swig_types[%d] \n", ki.key, i);
Printv(types,"static swig_type_info _swigt_", ki.key, "[] = {", NIL);