Eliminate needless casting away const from string constants

This commit is contained in:
Olly Betts 2014-04-30 12:00:23 +12:00
commit 36be36d618
26 changed files with 50 additions and 50 deletions

View file

@ -1418,7 +1418,7 @@ static void mark_nodes_as_extend(Node *n) {
String *nexcept;
} dtype;
struct {
char *type;
const char *type;
String *filename;
int line;
} loc;
@ -2002,8 +2002,8 @@ include_directive: includetype options string BEGINFILE {
}
;
includetype : INCLUDE { $$.type = (char *) "include"; }
| IMPORT { $$.type = (char *) "import"; ++import_mode;}
includetype : INCLUDE { $$.type = "include"; }
| IMPORT { $$.type = "import"; ++import_mode;}
;
/* ------------------------------------------------------------
@ -4292,7 +4292,7 @@ cpp_namespace_decl : NAMESPACE idcolon LBRACE {
| NAMESPACE LBRACE {
Hash *h;
$1 = Swig_symbol_current();
h = Swig_symbol_clookup((char *)" ",0);
h = Swig_symbol_clookup(" ",0);
if (h && (Strcmp(nodeType(h),"namespace") == 0)) {
Swig_symbol_setscope(Getattr(h,"symtab"));
} else {
@ -5271,7 +5271,7 @@ notso_direct_declarator : idcolon {
SwigType *t;
$$ = $1;
t = NewStringEmpty();
SwigType_add_array(t,(char*)"");
SwigType_add_array(t,"");
if ($$.type) {
SwigType_push(t,$$.type);
Delete($$.type);
@ -5370,7 +5370,7 @@ direct_declarator : idcolon {
SwigType *t;
$$ = $1;
t = NewStringEmpty();
SwigType_add_array(t,(char*)"");
SwigType_add_array(t,"");
if ($$.type) {
SwigType_push(t,$$.type);
Delete($$.type);
@ -5540,7 +5540,7 @@ direct_abstract_declarator : direct_abstract_declarator LBRACKET RBRACKET {
SwigType *t;
$$ = $1;
t = NewStringEmpty();
SwigType_add_array(t,(char*)"");
SwigType_add_array(t,"");
if ($$.type) {
SwigType_push(t,$$.type);
Delete($$.type);
@ -5563,7 +5563,7 @@ direct_abstract_declarator : direct_abstract_declarator LBRACKET RBRACKET {
$$.id = 0;
$$.parms = 0;
$$.have_parms = 0;
SwigType_add_array($$.type,(char*)"");
SwigType_add_array($$.type,"");
}
| LBRACKET expr RBRACKET {
$$.type = NewStringEmpty();

View file

@ -20,7 +20,7 @@
// #define ALLEGROCL_TYPE_DEBUG
// #define ALLEGROCL_CLASS_DEBUG
static const char *usage = (char *) "\
static const char *usage = "\
Allegro CL Options (available with -allegrocl)\n\
-identifier-converter <type or funcname> - \n\
Specifies the type of conversion to do on C identifiers to convert\n\

View file

@ -714,7 +714,7 @@ Allocate():
/* Check if base classes allow smart pointers, but might be hidden */
if (!Getattr(n, "allocate:smartpointer")) {
Node *sp = Swig_symbol_clookup((char *) "operator ->", 0);
Node *sp = Swig_symbol_clookup("operator ->", 0);
if (sp) {
/* Look for parent */
Node *p = parentNode(sp);
@ -833,7 +833,7 @@ Allocate():
or reference. We're going to chase it to see if another operator->()
can be found */
if ((SwigType_check_decl(type, "")) || (SwigType_check_decl(type, "r."))) {
Node *nn = Swig_symbol_clookup((char *) "operator ->", Getattr(sc, "symtab"));
Node *nn = Swig_symbol_clookup("operator ->", Getattr(sc, "symtab"));
if (nn) {
Delete(base);
Delete(type);

View file

@ -18,7 +18,7 @@
//#define CFFI_DEBUG
//#define CFFI_WRAP_DEBUG
static const char *usage = (char *) "\
static const char *usage = "\
CFFI Options (available with -cffi)\n\
-generate-typedef - Use defctype to generate shortcuts according to the\n\
typedefs in the input.\n\

View file

@ -15,7 +15,7 @@
#include <ctype.h>
static const char *usage = (char *) "\
static const char *usage = "\
\
CHICKEN Options (available with -chicken)\n\
-closprefix <prefix> - Prepend <prefix> to all clos identifiers\n\
@ -29,7 +29,7 @@ CHICKEN Options (available with -chicken)\n\
\n";
static char *module = 0;
static char *chicken_path = (char *) "chicken";
static const char *chicken_path = "chicken";
static int num_methods = 0;
static File *f_begin = 0;
@ -620,7 +620,7 @@ int CHICKEN::functionWrapper(Node *n) {
if (in_class)
clos_name = NewString(member_name);
else
clos_name = chickenNameMapping(scmname, (char *) "");
clos_name = chickenNameMapping(scmname, "");
if (!any_specialized_arg) {
method_def = NewString("");
@ -775,7 +775,7 @@ int CHICKEN::variableWrapper(Node *n) {
if (in_class)
clos_name = NewString(member_name);
else
clos_name = chickenNameMapping(scmname, (char *) "");
clos_name = chickenNameMapping(scmname, "");
Node *class_node = classLookup(t);
String *clos_code = Getattr(n, "tmap:varin:closcode");
@ -942,7 +942,7 @@ int CHICKEN::constantWrapper(Node *n) {
if (in_class)
clos_name = NewString(member_name);
else
clos_name = chickenNameMapping(scmname, (char *) "");
clos_name = chickenNameMapping(scmname, "");
if (GetFlag(n, "feature:constasvar")) {
Printv(clos_methods, "(define ", clos_name, " (", chickenPrimitiveName(scmname), "))\n", NIL);
Printv(scm_const_defs, "(set! ", scmname, " (", scmname, "))\n", NIL);
@ -1372,7 +1372,7 @@ void CHICKEN::dispatchFunction(Node *n) {
} else if (in_class)
clos_name = NewString(member_name);
else
clos_name = chickenNameMapping(scmname, (char *) "");
clos_name = chickenNameMapping(scmname, "");
Iterator f;
List *prev = 0;

View file

@ -13,7 +13,7 @@
#include "swigmod.h"
static const char *usage = (char *) "\
static const char *usage = "\
CLISP Options (available with -clisp)\n\
-extern-all - Create clisp definitions for all the functions and\n\
global variables otherwise only definitions for\n\

View file

@ -4303,7 +4303,7 @@ extern "C" Language *swig_csharp(void) {
* Static member variables
* ----------------------------------------------------------------------------- */
const char *CSHARP::usage = (char *) "\
const char *CSHARP::usage = "\
C# Options (available with -csharp)\n\
-dllimport <dl> - Override DllImport attribute name to <dl>\n\
-namespace <nm> - Generate wrappers into C# namespace <nm>\n\

View file

@ -4649,7 +4649,7 @@ extern "C" Language *swig_d(void) {
/* -----------------------------------------------------------------------------
* Usage information displayed at the command line.
* ----------------------------------------------------------------------------- */
const char *D::usage = (char *) "\
const char *D::usage = "\
D Options (available with -d)\n\
-d2 - Generate code for D2/Phobos (default: D1/Tango)\n\
-package <pkg> - Write generated D modules into package <pkg>\n\

View file

@ -5019,7 +5019,7 @@ extern "C" Language *swig_go(void) {
* ----------------------------------------------------------------------------- */
// Usage message.
const char * const GO::usage = (char *) "\
const char * const GO::usage = "\
Go Options (available with -go)\n\
-gccgo - Generate code for gccgo rather than 6g/8g\n\
-go-pkgpath <p> - Like gccgo -fgo-pkgpath option\n\

View file

@ -16,7 +16,7 @@
#include <ctype.h>
// Note string broken in half for compilers that can't handle long strings
static const char *usage = (char *) "\
static const char *usage = "\
Guile Options (available with -guile)\n\
-emitsetters - Emit procedures-with-setters for variables\n\
and structure slots.\n\
@ -1018,7 +1018,7 @@ public:
if (in_class)
goops_name = NewString(memberfunction_name);
else
goops_name = goopsNameMapping(proc_name, (char *) "");
goops_name = goopsNameMapping(proc_name, "");
String *primitive_name = NewString("");
if (primRenamer)
Printv(primitive_name, "primitive:", proc_name, NIL);
@ -1204,7 +1204,7 @@ public:
// export wrapper into goops file
if (!in_class) { // only if the variable is not part of a class
String *class_name = SwigType_typedef_resolve_all(SwigType_base(t));
String *goops_name = goopsNameMapping(proc_name, (char *) "");
String *goops_name = goopsNameMapping(proc_name, "");
String *primitive_name = NewString("");
if (primRenamer)
Printv(primitive_name, "primitive:", NIL);

View file

@ -4643,7 +4643,7 @@ extern "C" Language *swig_java(void) {
* Static member variables
* ----------------------------------------------------------------------------- */
const char *JAVA::usage = (char *) "\
const char *JAVA::usage = "\
Java Options (available with -java)\n\
-nopgcpp - Suppress premature garbage collection prevention parameter\n\
-noproxy - Generate the low-level functional interface instead\n\

View file

@ -86,7 +86,7 @@ extern "C"
you can add new ones here
(though for now I have not bothered)
NEW LANGUAGE NOTE:END ************************************************/
static const char *usage = (char *) "\
static const char *usage = "\
Lua Options (available with -lua)\n\
-elua - Generates LTR compatible wrappers for smaller devices running elua\n\
-eluac - LTR compatible wrappers in \"crass compress\" mode for elua\n\

View file

@ -160,9 +160,9 @@ static String *SwigLib = 0; // Library directory
static String *SwigLibWinUnix = 0; // Extra library directory on Windows
static int freeze = 0;
static String *lang_config = 0;
static char *hpp_extension = (char *) "h";
static char *cpp_extension = (char *) "cxx";
static char *depends_extension = (char *) "d";
static const char *hpp_extension = "h";
static const char *cpp_extension = "cxx";
static const char *depends_extension = "d";
static String *outdir = 0;
static String *xmlout = 0;
static int outcurrentdir = 0;
@ -324,7 +324,7 @@ const String *SWIG_output_directory() {
}
void SWIG_config_cppext(const char *ext) {
cpp_extension = (char *) ext;
cpp_extension = ext;
}
List *SWIG_output_files() {
@ -465,7 +465,7 @@ void SWIG_getoptions(int argc, char *argv[]) {
Swig_mark_arg(i);
} else if (strncmp(argv[i], "-D", 2) == 0) {
String *d = NewString(argv[i] + 2);
Replace(d, (char *) "=", (char *) " ", DOH_REPLACE_ANY | DOH_REPLACE_FIRST);
Replace(d, "=", " ", DOH_REPLACE_ANY | DOH_REPLACE_FIRST);
Preprocessor_define((DOH *) d, 0);
Delete(d);
// Create a symbol

View file

@ -3956,7 +3956,7 @@ extern "C" Language *swig_modula3(void) {
* Static member variables
* ----------------------------------------------------------------------------- */
const char *MODULA3::usage = (char *) "\
const char *MODULA3::usage = "\
Modula 3 Options (available with -modula3)\n\
-generateconst <file> - Generate code for computing numeric values of constants\n\
-generaterename <file> - Generate suggestions for %rename\n\

View file

@ -15,7 +15,7 @@
#include <ctype.h>
static const char *usage = (char *) "\
static const char *usage = "\
Mzscheme Options (available with -mzscheme)\n\
-declaremodule - Create extension that declares a module\n\
-dynamic-load <library>,[library,...] - Do not link with these libraries, dynamic load\n\
@ -36,7 +36,7 @@ static bool declaremodule = false;
static bool noinit = false;
static String *load_libraries = NULL;
static String *module = 0;
static char *mzscheme_path = (char *) "mzscheme";
static const char *mzscheme_path = "mzscheme";
static String *init_func_def = 0;
static File *f_begin = 0;

View file

@ -15,7 +15,7 @@
#include <ctype.h>
static const char *usage = (char *) "\
static const char *usage = "\
Ocaml Options (available with -ocaml)\n\
-oldvarnames - Old intermediary method names for variable wrappers\n\
-prefix <name> - Set a prefix <name> to be prepended to all names\n\
@ -29,7 +29,7 @@ static int const_enum = 0;
static int static_member_function = 0;
static int generate_sizeof = 0;
static String *prefix = 0;
static char *ocaml_path = (char *) "ocaml";
static const char *ocaml_path = "ocaml";
static bool old_variable_names = false;
static String *classname = 0;
static String *module = 0;

View file

@ -17,7 +17,7 @@
static String *global_name = 0;
static String *op_prefix = 0;
static const char *usage = (char *) "\
static const char *usage = "\
Octave Options (available with -octave)\n\
-globals <name> - Set <name> used to access C global variables [default: 'cvar']\n\
Use '.' to load C global variables into module namespace\n\

View file

@ -17,7 +17,7 @@ static int treduce = SWIG_cparse_template_reduce(0);
#include <ctype.h>
static const char *usage = (char *) "\
static const char *usage = "\
Perl5 Options (available with -perl5)\n\
-compat - Compatibility mode\n\
-const - Wrap constants as constants and not variables (implies -proxy)\n\

View file

@ -42,7 +42,7 @@
#include <ctype.h>
#include <errno.h>
static const char *usage = (char *) "\
static const char *usage = "\
PHP Options (available with -php)\n\
-cppext <ext> - Change C++ file extension to <ext> (default is cpp)\n\
-noproxy - Don't generate proxy classes.\n\

View file

@ -33,7 +33,7 @@
#include <ctype.h> // for isalnum()
static const char *usage = (char *) "\
static const char *usage = "\
Pike Options (available with -pike)\n\
[no additional options]\n\
\n";

View file

@ -107,7 +107,7 @@ enum autodoc_t {
};
static const char *usage1 = (char *) "\
static const char *usage1 = "\
Python Options (available with -python)\n\
-aliasobj0 - Alias obj0 when using fastunpack, needed for some old typemaps \n\
-buildnone - Use Py_BuildValue(" ") to obtain Py_None (default in Windows)\n\
@ -127,7 +127,7 @@ Python Options (available with -python)\n\
-keyword - Use keyword arguments\n\
-modern - Use modern python features only, without compatibility code\n\
-modernargs - Use \"modern\" args mechanism to pack/unpack the function arguments\n";
static const char *usage2 = (char *) "\
static const char *usage2 = "\
-newrepr - Use more informative version of __repr__ in proxy classes (default) \n\
-newvwm - New value wrapper mode, use only when everything else fails \n\
-noaliasobj0 - Don't generate an obj0 alias when using fastunpack (default) \n\
@ -144,7 +144,7 @@ static const char *usage2 = (char *) "\
-noh - Don't generate the output header file\n\
-nomodern - Don't use modern python features which are not backwards compatible \n\
-nomodernargs - Use classic ParseTuple/CallFunction methods to pack/unpack the function arguments (default) \n";
static const char *usage3 = (char *) "\
static const char *usage3 = "\
-noolddefs - Don't emit the old method definitions even when using fastproxy (default) \n\
-nooutputtuple - Use a PyList for appending output values (default) \n\
-noproxy - Don't generate proxy classes \n\

View file

@ -205,7 +205,7 @@ static void writeListByLine(List *l, File *out, bool quote = 0) {
}
static const char *usage = (char *)"\
static const char *usage = "\
R Options (available with -r)\n\
-copystruct - Emit R code to copy C structs (on by default)\n\
-cppcast - Enable C++ casting operators (default) \n\

View file

@ -130,7 +130,7 @@ enum autodoc_t {
AUTODOC_NONE
};
static const char *usage = (char *) "\
static const char *usage = "\
Ruby Options (available with -ruby)\n\
-autorename - Enable renaming of classes and methods to follow Ruby coding standards\n\
-cppcast - Enable C++ casting operators (default)\n\
@ -1111,7 +1111,7 @@ public:
/* typedef void *VALUE */
SwigType *value = NewSwigType(T_VOID);
SwigType_add_pointer(value);
SwigType_typedef(value, (char *) "VALUE");
SwigType_typedef(value, "VALUE");
Delete(value);
/* Set module name */

View file

@ -15,7 +15,7 @@
#include "cparse.h"
static int treduce = SWIG_cparse_template_reduce(0);
static const char *usage = (char *) "\
static const char *usage = "\
Tcl 8 Options (available with -tcl)\n\
-itcl - Enable ITcl support\n\
-nosafe - Leave out SafeInit module function.\n\

View file

@ -15,7 +15,7 @@
#include "swigmod.h"
static const char *usage = (char *) "\
static const char *usage = "\
UFFI Options (available with -uffi)\n\
-identifier-converter <type or funcname> - \n\
Specifies the type of conversion to do on C identifiers\n\

View file

@ -467,7 +467,7 @@ static String *Swig_cmethod_call(const_String_or_char_ptr name, ParmList *parms,
return func;
if (!self)
self = (char *) "(this)->";
self = "(this)->";
Append(func, self);
if (SwigType_istemplate(name) && (strncmp(Char(name), "operator ", 9) == 0)) {