Source code modifications used to quiet gcc [long message]
Robert Resendes
resendes@ici.net
Mon, 25 Aug 1997 20:25:34 -0400 (EDT)
-----BEGIN PGP SIGNED MESSAGE-----
Hello all,
I am trying to package omniORB for a Linux distribution and one of the
requirements is to eliminate warning/error messages. I have enclosed
the modifications (below, in a patch format) that I used for the following
system configuration:
- - Kernel 2.0.29
- - Gnu C++ 2.7.2.1
- - Binutils 2.7.0.9
- - Linux C Library 5.4.33
- - Linux C++ Library 2.7.2.1
- - Linuxthreads 0.5
- - Architecture __i86__
Note:
1 - I still have one warning left in the example application code that
I can't seem to get rid of.
2 - I had to modify the makefiles in some cases to turn off warnings
(used -Wno-reorder to remove benign reordering messages overall and
used special compile rule for lex.yy.cc to remove numerous
warnings).
3 - My patches include all the patches available at the ominORB
"news" page (http://www.orl.co.uk/omniORB/omniORBNews.html).
- ------------------------- Cut here ------------------------------------
- --- omniorb-2.2.0.orig/src/lib/omnithread/posix.cc
+++ omniorb-2.2.0/src/lib/omnithread/posix.cc
@@ -50,7 +50,11 @@
#include <time.h>
#include "omnithread.h"
- -#ifdef __linux__
+#if defined(__linux__)
+#include <unistd.h>
+#endif
+
+#if defined(__linux__) && defined(_MIT_POSIX_THREADS)
#include <pthread/mit/sys/timers.h>
#endif
- --- omniorb-2.2.0.orig/src/lib/omniORB2/orb.cc
+++ omniorb-2.2.0/src/lib/omniORB2/orb.cc
@@ -708,7 +708,7 @@
}
return 0;
}
- - if (sscanf(argv[idx+1],"%u",&omniORB::traceLevel) != 1) {
+ if (sscanf(argv[idx+1],"%lu",&omniORB::traceLevel) != 1) {
if (omniORB::traceLevel > 0) {
cerr << "CORBA::ORB_init failed: invalid -ORBtraceLevel parameter."
<< endl;
@@ -817,7 +817,7 @@
return 0;
}
CORBA::ULong port;
- - if (sscanf(argv[idx+1],"%u",&port) != 1 ||
+ if (sscanf(argv[idx+1],"%lu",&port) != 1 ||
(port == 0 || port >= 65536)) {
if (omniORB::traceLevel > 0) {
cerr << "BOA_init failed: invalid -BOAiiop_port parameter." << endl;
- --- omniorb-2.2.0.orig/src/lib/omniORB2/corbaString.cc
+++ omniorb-2.2.0/src/lib/omniORB2/corbaString.cc
@@ -104,7 +104,7 @@
char &
CORBA::String_var::operator[] (CORBA::ULong index)
{
- - if (!_data || strlen(_data) < (int)index) {
+ if (!_data || strlen(_data) < index) {
_CORBA_bound_check_error(); // never return
}
return _data[index];
@@ -113,7 +113,7 @@
char
CORBA::String_var::operator[] (CORBA::ULong index) const
{
- - if (!_data || strlen(_data) < (int)index) {
+ if (!_data || strlen(_data) < index) {
_CORBA_bound_check_error(); // never return
}
return _data[index];
- --- omniorb-2.2.0.orig/src/lib/omniORB2/objectKey.cc
+++ omniorb-2.2.0/src/lib/omniORB2/objectKey.cc
@@ -153,7 +153,7 @@
omniORB::seqOctets* result = new omniORB::seqOctets;
result->length(sizeof(omniORB::objectKey));
const CORBA::Octet* p = (const CORBA::Octet*) &k1;
- - for (int i=0; i< sizeof(omniORB::objectKey); i++) {
+ for (unsigned int i=0; i< sizeof(omniORB::objectKey); i++) {
result->operator[](i) = p[i];
}
return result;
@@ -167,7 +167,7 @@
}
omniORB::objectKey result;
CORBA::Octet* p = (CORBA::Octet*) &result;
- - for (int i=0; i< sizeof(omniORB::objectKey); i++) {
+ for (unsigned int i=0; i< sizeof(omniORB::objectKey); i++) {
p[i] = seq[i];
}
return result;
- --- omniorb-2.2.0.orig/src/tool/omniidl2/ast/ast_array.cc
+++ omniorb-2.2.0/src/tool/omniidl2/ast/ast_array.cc
@@ -105,7 +105,7 @@
{
AST_Expression **result;
UTL_ExprlistActiveIterator *l;
- - long i;
+ unsigned long i;
if (ds == NULL)
return NULL;
@@ -134,7 +134,7 @@
void
AST_Array::dump(ostream &o)
{
- - long i;
+ unsigned long i;
pd_base_type->dump(o);
o << " ";
- --- omniorb-2.2.0.orig/src/tool/omniidl2/ast/ast_constant.cc
+++ omniorb-2.2.0/src/tool/omniidl2/ast/ast_constant.cc
@@ -115,6 +115,16 @@
return "void";
case AST_Expression::EV_none:
return "none";
+ case AST_Expression::EV_wstring:
+ return "wstring";
+ case AST_Expression::EV_wchar:
+ return "wchar";
+ case AST_Expression::EV_longdouble:
+ return "longdouble";
+ case AST_Expression::EV_ulonglong:
+ return "ulonglong";
+ case AST_Expression::EV_longlong:
+ return "longlong";
}
return 0; // for MSVC++ 4.2
}
- --- omniorb-2.2.0.orig/src/tool/omniidl2/ast/ast_decl.cc
+++ omniorb-2.2.0/src/tool/omniidl2/ast/ast_decl.cc
@@ -100,12 +100,12 @@
AST_Decl::AST_Decl(NodeType nt, UTL_ScopedName *n, UTL_StrList *p)
: pd_node_type(nt),
pd_line(idl_global->lineno()),
- - pd_local_name(n == NULL ? NULL : n->last_component()),
+ pd_local_name(n == NULL ? (Identifier *)NULL : n->last_component()),
pd_file_name(idl_global->filename()),
pd_pragmas(p),
pd_defined_in(idl_global->scopes()->depth() > 0
? idl_global->scopes()->top()
- - : NULL),
+ : (UTL_Scope *)NULL),
pd_imported(idl_global->imported()),
pd_in_main_file(idl_global->in_main_file()),
pd_added(I_FALSE)
- --- omniorb-2.2.0.orig/src/tool/omniidl2/ast/ast_expression.cc
+++ omniorb-2.2.0/src/tool/omniidl2/ast/ast_expression.cc
@@ -86,7 +86,7 @@
{
pd_defined_in = idl_global->scopes()->depth() > 0
? idl_global->scopes()->top()
- - : NULL;
+ : (UTL_Scope *)NULL;
pd_line = idl_global->lineno();
pd_file_name = idl_global->filename();
}
@@ -376,6 +376,8 @@
case AST_Expression::EV_void:
case AST_Expression::EV_none:
return NULL;
+ default:
+ return NULL;
}
case AST_Expression::EV_ushort:
switch (ev->et) {
@@ -430,6 +432,8 @@
case AST_Expression::EV_void:
case AST_Expression::EV_none:
return NULL;
+ default:
+ return NULL;
}
case AST_Expression::EV_long:
switch (ev->et) {
@@ -478,6 +482,8 @@
case AST_Expression::EV_void:
case AST_Expression::EV_none:
return NULL;
+ default:
+ return NULL;
}
case AST_Expression::EV_ulong:
switch (ev->et) {
@@ -530,6 +536,8 @@
case AST_Expression::EV_void:
case AST_Expression::EV_none:
return NULL;
+ default:
+ return NULL;
}
case AST_Expression::EV_bool:
switch (ev->et) {
@@ -572,6 +580,8 @@
case AST_Expression::EV_void:
case AST_Expression::EV_none:
return NULL;
+ default:
+ return NULL;
}
case AST_Expression::EV_float:
switch (ev->et) {
@@ -616,6 +626,8 @@
case AST_Expression::EV_void:
case AST_Expression::EV_none:
return NULL;
+ default:
+ return NULL;
}
case AST_Expression::EV_double:
switch (ev->et) {
@@ -658,6 +670,8 @@
case AST_Expression::EV_void:
case AST_Expression::EV_none:
return NULL;
+ default:
+ return NULL;
}
case AST_Expression::EV_char:
switch (ev->et) {
@@ -714,6 +728,8 @@
case AST_Expression::EV_void:
case AST_Expression::EV_none:
return NULL;
+ default:
+ return NULL;
}
case AST_Expression::EV_octet:
switch (ev->et) {
@@ -770,6 +786,8 @@
case AST_Expression::EV_void:
case AST_Expression::EV_none:
return NULL;
+ default:
+ return NULL;
}
case AST_Expression::EV_any:
switch (ev->et) {
@@ -794,6 +812,8 @@
default:
return NULL;
}
+ default:
+ return NULL;
}
return 0; // for MSVC++ 4.2
}
@@ -1097,6 +1117,8 @@
case EV_string:
copy->u.strval = pd_ev->u.strval;
break;
+ default:
+ return NULL;
}
return coerce_value(copy, t);
@@ -1225,6 +1247,8 @@
case EV_void:
case EV_none:
return I_FALSE;
+ default:
+ return I_FALSE;
}
return 0; // for MSVC++ 4.2
}
@@ -1273,6 +1297,8 @@
case EV_void:
case EV_none:
return I_FALSE;
+ default:
+ return I_FALSE;
}
return 0; // for MSVC++ 4.2
}
@@ -1346,6 +1372,9 @@
case AST_Expression::EV_any:
case AST_Expression::EV_none:
case AST_Expression::EV_void:
+ break;
+ default:
+ o << "Unexpected/unknown value";
break;
}
}
- --- omniorb-2.2.0.orig/src/tool/omniidl2/driver/drv_fork.cc
+++ omniorb-2.2.0/src/tool/omniidl2/driver/drv_fork.cc
@@ -97,6 +97,11 @@
#include <sys/wait.h> // POSIX definition of wait()
#endif // defined(hpux) || defined(__hpux)
+#if defined(__linux__)
+#include <unistd.h> // POSIX standard types
+#include <sys/types.h> //
+#include <sys/wait.h> // POSIX definition of wait()
+#endif // defined(__linux__)
#ifndef __NT__
- --- omniorb-2.2.0.orig/src/tool/omniidl2/driver/drv_preproc.cc
+++ omniorb-2.2.0/src/tool/omniidl2/driver/drv_preproc.cc
@@ -109,6 +109,12 @@
#include <sys/wait.h> // POSIX definition of wait()
#endif // defined(hpux) || defined(__hpux)
+#if defined(__linux__)
+#include <unistd.h> // POSIX definitions
+#include <sys/types.h> //
+#include <sys/wait.h> // POSIX definition of wait()
+#endif // defined(__linux__)
+
#ifdef __NT__
#include <io.h>
#include <process.h>
- --- omniorb-2.2.0.orig/src/tool/omniidl2/fe/lex.yy.cc
+++ omniorb-2.2.0/src/tool/omniidl2/fe/lex.yy.cc
@@ -181,6 +181,7 @@
static char *__yytext = (char *) yytext;
# define YYNEWLINE 10
+int
yylex(){
int nstr; extern int yyprevious;
#ifdef __cplusplus
@@ -678,7 +679,7 @@
char *r = buf;
char *h;
char *j;
- - int count=0,jcount=0;
+ unsigned int count=0,jcount=0;
UTL_String *nm;
/* Skip initial '#' */
- --- omniorb-2.2.0.orig/src/tool/omniidl2/fe/Makefile
+++ omniorb-2.2.0/src/tool/omniidl2/fe/Makefile
@@ -30,6 +30,9 @@
$(RANLIB) $@; \
)
+lex.yy.o: lex.yy.cc
+ $(CXX) -c $(CPPFLAGS) -o $@ $<
+
#
# We don't seem to be able to regenerate y.tab.cc y.tab.hh and lex.yy.cc
# (at least on OSF)
- --- omniorb-2.2.0.orig/src/tool/omniidl2/util/utl_scope.cc
+++ omniorb-2.2.0/src/tool/omniidl2/util/utl_scope.cc
@@ -331,7 +331,7 @@
if (a == NULL) return NULL;
a->set_added(I_TRUE);
if (!a->field_type()->added()) {
- - return add_type(a->field_type()) ? a : NULL;
+ return add_type(a->field_type()) ? a : (AST_Attribute *)NULL;
} else
return a;
}
@@ -341,7 +341,7 @@
if (o == NULL) return NULL;
o->set_added(I_TRUE);
if (!o->return_type()->added()) {
- - return add_type(o->return_type()) ? o : NULL;
+ return add_type(o->return_type()) ? o : (AST_Operation *)NULL;
} else
return o;
}
@@ -351,7 +351,7 @@
if (a == NULL) return NULL;
a->set_added(I_TRUE);
if (!a->field_type()->added()) {
- - return add_type(a->field_type()) ? a : NULL;
+ return add_type(a->field_type()) ? a : (AST_Argument *)NULL;
} else
return a;
}
@@ -368,7 +368,7 @@
if (u == NULL) return NULL;
u->set_added(I_TRUE);
if (!u->field_type()->added()) {
- - return add_type(u->field_type()) ? u : NULL;
+ return add_type(u->field_type()) ? u : (AST_UnionBranch *)NULL;
} else
return u;
}
@@ -385,7 +385,7 @@
if (f == NULL) return NULL;
f->set_added(I_TRUE);
if (!f->field_type()->added()) {
- - return add_type(f->field_type()) ? f : NULL;
+ return add_type(f->field_type()) ? f : (AST_Field *)NULL;
} else
return f;
}
@@ -409,7 +409,7 @@
if (t == NULL) return NULL;
t->set_added(I_TRUE);
if (!t->base_type()->added()) {
- - return add_type(t->base_type()) ? t : NULL;
+ return add_type(t->base_type()) ? t : (AST_Typedef *)NULL;
} else
return t;
}
@@ -419,7 +419,7 @@
if (s == NULL) return NULL;
s->set_added(I_TRUE);
if (!s->base_type()->added()) {
- - return add_type(s->base_type()) ? s : NULL;
+ return add_type(s->base_type()) ? s : (AST_Sequence *)NULL;
} else
return s;
}
@@ -436,7 +436,7 @@
if (a == NULL) return NULL;
a->set_added(I_TRUE);
if (!a->base_type()->added()) {
- - return add_type(a->base_type()) ? a : NULL;
+ return add_type(a->base_type()) ? a : (AST_Array *)NULL;
} else
return a;
}
- --- omniorb-2.2.0.orig/src/tool/omniidl2/util/utl_string.cc
+++ omniorb-2.2.0/src/tool/omniidl2/util/utl_string.cc
@@ -134,7 +134,7 @@
void
UTL_String::canonicalize()
{
- - long i;
+ unsigned long i;
for (i = 0; i < len; i++)
c_str[i] = isalpha(p_str[i]) ? toupper(p_str[i]) : p_str[i];
- --- omniorb-2.2.0.orig/src/tool/omniidl2/util/utl_error.cc
+++ omniorb-2.2.0/src/tool/omniidl2/util/utl_error.cc
@@ -193,6 +193,8 @@
return "void";
case AST_Expression::EV_none:
return "none";
+ default:
+ return "unexpectedType";
}
return 0; // for MSVC++ 4.2
}
- --- omniorb-2.2.0.orig/src/tool/omniidl2/omniORB2_be/o2be_name.cc
+++ omniorb-2.2.0/src/tool/omniidl2/omniORB2_be/o2be_name.cc
@@ -67,10 +67,10 @@
// Check the pragmas attached to this node to see if
// pragma ID is defined to override the default repositoryID.
UTL_String* id;
- - if (id = internal_search_pragma(pd_decl,"ID")) {
+ if ((id = internal_search_pragma(pd_decl,"ID"))) {
return id->get_string();
}
- - else if (id = internal_search_pragma(pd_decl,"version")) {
+ else if ((id = internal_search_pragma(pd_decl,"version"))) {
// Check if pragma version is defined to override the
// version number in the default repositoryID.
char* p = strrchr(pd_repositoryID,':') + 1;
- --- omniorb-2.2.0.orig/src/tool/omniidl2/omniORB2_be/o2be_exception.cc
+++ omniorb-2.2.0/src/tool/omniidl2/omniORB2_be/o2be_exception.cc
@@ -25,6 +25,11 @@
/*
$Log: o2be_exception.cc,v $
+ Revision 1.5 1997/08/13 09:23:38 sll
+ o2be_exception::repoIdConstLen() now returns the correct length of the
+ repository ID. Previously, it wrongly returns the length of the header macro
+ name.
+
// Revision 1.4 1997/05/06 13:54:46 sll
// Public release.
//
@@ -45,7 +50,7 @@
pd_repoid = new char[strlen(_fqname())+strlen(IRREPOID_POSTFIX)+1];
strcpy(pd_repoid,_fqname());
strcat(pd_repoid,IRREPOID_POSTFIX);
- - pd_repoidsize = strlen(pd_repoid)+1;
+ pd_repoidsize = strlen(repositoryID())+1;
}
void
- --- omniorb-2.2.0.orig/src/tool/omniidl2/omniORB2_be/o2be_array.cc
+++ omniorb-2.2.0/src/tool/omniidl2/omniORB2_be/o2be_array.cc
@@ -123,7 +123,7 @@
{
size_t dim = 1;
AST_Expression **d = dims();
- - int i;
+ unsigned int i;
for (i=0; i < n_dims(); i++)
{
AST_Expression::AST_ExprValue *v = d[i]->ev();
- --- omniorb-2.2.0.orig/src/tool/omniidl2/omniORB2_be/o2be_union.cc
+++ omniorb-2.2.0/src/tool/omniidl2/omniORB2_be/o2be_union.cc
@@ -2037,7 +2037,7 @@
return I_TRUE;
break;
case AST_PredefinedType::PT_boolean:
- - if (bv->u.bval == v.b_val)
+ if ((long)bv->u.bval == v.b_val)
return I_TRUE;
break;
default:
- --- omniorb-2.2.0.orig/src/appl/utils/catior/catior.cc
+++ omniorb-2.2.0/src/appl/utils/catior/catior.cc
@@ -28,6 +28,10 @@
#include <stdlib.h>
#include <omniORB2/CORBA.h>
+
+#if defined(__linux__)
+#include <unistd.h>
+#endif
@@ -165,7 +169,7 @@
cerr << "Type ID: \"" << (char*) repoID << "\"" << endl;
cerr << "Profiles:" << endl;
- - for (long count=0; count < profiles->length(); count++)
+ for (unsigned long count=0; count < profiles->length(); count++)
{
cout << count+1 << ". ";
- --- omniorb-2.2.0.orig/include/omniORB2/CORBA.h
+++ omniorb-2.2.0/include/omniORB2/CORBA.h
@@ -728,6 +728,7 @@
class Object;
typedef Object *Object_ptr;
+ typedef Object_ptr ObjectRef;
typedef _CORBA_Unbounded_Sequence_Octet ReferenceData;
- --- omniorb-2.2.0.orig/mk/x86_linux_2.0.mk
+++ omniorb-2.2.0/mk/x86_linux_2.0.mk
@@ -27,7 +27,7 @@
CXX = gcc
CXXFLAGS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(CPPFLAGS)
CXXDEBUGFLAGS =
- -CXXOPTIONS = -fhandle-exceptions -Wall -Wno-unused
+CXXOPTIONS = -fhandle-exceptions -Wall -Wno-unused -Wno-reorder
CXXLINK = g++
CXXLINKOPTIONS = $(CXXDEBUGFLAGS) $(CXXOPTIONS)
- ------------------------- End ------------------------------------
- -----------------
resendes@ici.net
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3a
Charset: noconv
iQCVAwUBNAIiiMwhYdcUoZLxAQEJ1QP/aQCA/eVare1nHS6NT1Ao+dXvkqEDnd2z
QNqKA59xxjmK98GzA0r9Leusw1fxXo6DOxB3yJOwb+RKWNd46DRT9T0oVm4EKhvQ
GKDY1WksZAAYnpvMzPMaYR0/GzDa80xQ/ivv/gtRriHoyJCE5/ZCxQD6Mj0Vs81U
gL9+8cGvlSU=
=oADv
-----END PGP SIGNATURE-----