From 3ee442c54f658e0dc9541a492e46fd8f6bf3a7f4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 23 Dec 2007 20:22:46 -0600 Subject: r26571: Hide warnings about unused macros and casting qualifiers in autogenerated files. (This used to be commit cb76c60007ae1254181c09ba1ab09c419f500bc5) --- source4/build/m4/check_cc.m4 | 4 ++++ source4/build/smb_build/input.pm | 3 +++ source4/build/smb_build/makefile.pm | 33 ++++++++++++++++++--------------- source4/dynconfig.mk | 2 +- source4/lib/registry/registry_wrap.c | 28 +++++++--------------------- source4/libcli/util/errors.i | 4 ++-- source4/scripting/python/misc_wrap.c | 8 ++------ 7 files changed, 37 insertions(+), 45 deletions(-) (limited to 'source4') diff --git a/source4/build/m4/check_cc.m4 b/source4/build/m4/check_cc.m4 index 586ba9b814..569be38721 100644 --- a/source4/build/m4/check_cc.m4 +++ b/source4/build/m4/check_cc.m4 @@ -112,6 +112,10 @@ if test x$developer = xyes; then AX_CFLAGS_GCC_OPTION(-Wformat=2, DEVELOPER_CFLAGS) AX_CFLAGS_GCC_OPTION(-Wdeclaration-after-statement, DEVELOPER_CFLAGS) AX_CFLAGS_GCC_OPTION(-Wunused-macros, DEVELOPER_CFLAGS) + AX_CFLAGS_GCC_OPTION(-Wno-unused-macros, CFLAG_NO_UNUSED_MACROS) + AC_SUBST(CFLAG_NO_CAST_QUAL) + AC_SUBST(CFLAG_NO_UNUSED_MACROS) + AX_CFLAGS_GCC_OPTION(-Wno-cast-qual, CFLAG_NO_CAST_QUAL) # AX_CFLAGS_GCC_OPTION(-Wextra, DEVELOPER_CFLAGS) # AX_CFLAGS_GCC_OPTION(-Wc++-compat, DEVELOPER_CFLAGS) # AX_CFLAGS_GCC_OPTION(-Wmissing-prototypes, DEVELOPER_CFLAGS) diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm index 92ab54a10e..431fd3cb83 100644 --- a/source4/build/smb_build/input.pm +++ b/source4/build/smb_build/input.pm @@ -165,6 +165,9 @@ sub check_python($$) $python->{OBJ_FILES} = ["$dirname$basename\_wrap.o"]; $python->{LIBRARY_REALNAME} = "_$basename.\$(SHLIBEXT)"; $python->{PYTHON_FILES} = ["$dirname$basename.py"]; + unless (defined($python->{CFLAGS})) { $python->{CFLAGS} = []; } + push (@{$python->{CFLAGS}}, $config::config{CFLAG_NO_UNUSED_MACROS}); + push (@{$python->{CFLAGS}}, $config::config{CFLAG_NO_CAST_QUAL}); } else { my $basename = $python->{NAME}; $basename =~ s/^python_//g; diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index d9b5ac4d78..aa1dc1f761 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -121,15 +121,15 @@ FIRST_PREREQ = $first_prereq # Dependencies command DEPENDS = \$(CC) -M -MG -MP -MT \$(<:.c=.o) -MT \$@ \\ - `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\ - \$(CFLAGS) \$(FIRST_PREREQ) -o \$@ + \$(CFLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\ + \$(CPPFLAGS) \$(FIRST_PREREQ) -o \$@ # Dependencies for host objects HDEPENDS = \$(CC) -M -MG -MP -MT \$(<:.c=.ho) -MT \$@ \\ - `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\ - \$(HOSTCC_FLAGS) \$(FIRST_PREREQ) -o \$@ + \$(HOSTCC_FLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\ + \$(CPPFLAGS) \$(FIRST_PREREQ) -o \$@ # Dependencies for precompiled headers PCHDEPENDS = \$(CC) -M -MG -MT include/includes.h.gch -MT \$@ \\ - \$(CFLAGS) \$(FIRST_PREREQ) -o \$@ + \$(CFLAGS) \$(CPPFLAGS) \$(FIRST_PREREQ) -o \$@ # \$< is broken in older BSD versions: # when \$@ is foo/bar.o, \$< could be torture/foo/bar.c @@ -140,21 +140,23 @@ PCHDEPENDS = \$(CC) -M -MG -MT include/includes.h.gch -MT \$@ \\ # building with \$srcdir != \$builddir work. # Run a static analysis checker -CHECK = \$(CC_CHECKER) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\ - \$(CFLAGS) \$(PICFLAG) -c \$(FIRST_PREREQ) -o \$@ +CHECK = \$(CC_CHECKER) \$(CFLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\ + \$(PICFLAG) \$(CPPLAGS) -c \$(FIRST_PREREQ) -o \$@ # Run the configured compiler -COMPILE = \$(CC) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\ - \$(CFLAGS) \$(PICFLAG) -c \$(FIRST_PREREQ) -o \$@ +COMPILE = \$(CC) \$(CFLAGS) \$(PICFLAG) \\ + `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\ + \$(CPPFLAGS) \\ + -c \$(FIRST_PREREQ) -o \$@ # Run the compiler for the build host -HCOMPILE = \$(HOSTCC) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\ - \$(HOSTCC_FLAGS) -c \$(FIRST_PREREQ) -o \$@ +HCOMPILE = \$(HOSTCC) \$(HOSTCC_FLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\ + \$(CPPFLAGS) -c \$(FIRST_PREREQ) -o \$@ # Precompile headers PCHCOMPILE = @\$(CC) -Ilib/replace \\ - `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\ - \$(CFLAGS) \$(PICFLAG) -c \$(FIRST_PREREQ) -o \$@ + \$(CFLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\ + \$(PICFLAG) \$(CPPFLAGS) -c \$(FIRST_PREREQ) -o \$@ __EOD__ ); @@ -190,7 +192,8 @@ CPP=$self->{config}->{CPP} CPPFLAGS=$builddir_headers-I\$(srcdir)/include -I\$(srcdir) -I\$(srcdir)/lib -I\$(srcdir)/lib/replace -I\$(srcdir)/lib/talloc -D_SAMBA_BUILD_=4 -DHAVE_CONFIG_H $self->{config}->{CPPFLAGS} CC=$self->{config}->{CC} -CFLAGS=$self->{config}->{CFLAGS} \$(CPPFLAGS) +CFLAGS=$self->{config}->{CFLAGS} +CFLAG_NO_UNUSED_MACROS=$self->{config}->{CFLAG_NO_UNUSED_MACROS} PICFLAG=$self->{config}->{PICFLAG} INSTALL_LINK_FLAGS=$extra_link_flags @@ -210,7 +213,7 @@ MDLD_FLAGS=$self->{config}->{MDLD_FLAGS} -L\$(builddir)/bin/shared SHLIBEXT=$self->{config}->{SHLIBEXT} HOSTCC=$self->{config}->{HOSTCC} -HOSTCC_FLAGS=-D_SAMBA_HOSTCC_ $self->{config}->{CFLAGS} \$(CPPFLAGS) +HOSTCC_FLAGS=-D_SAMBA_HOSTCC_ \$(CFLAGS) HOSTLD=$self->{config}->{HOSTLD} HOSTLD_FLAGS=$self->{config}->{LDFLAGS} diff --git a/source4/dynconfig.mk b/source4/dynconfig.mk index 1840ededac..9c872da3e8 100644 --- a/source4/dynconfig.mk +++ b/source4/dynconfig.mk @@ -21,5 +21,5 @@ PATH_FLAGS = -DCONFIGFILE=\"$(CONFIGFILE)\" \ dynconfig.o: dynconfig.c Makefile @echo Compiling $< - @$(CC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) \ + @$(CC) $(CFLAGS) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CPPFLAGS) $(PICFLAG) \ $(PATH_FLAGS) -c $(FIRST_PREREQ) -o $@ diff --git a/source4/lib/registry/registry_wrap.c b/source4/lib/registry/registry_wrap.c index cabdfad887..00c7fc32b2 100644 --- a/source4/lib/registry/registry_wrap.c +++ b/source4/lib/registry/registry_wrap.c @@ -2929,9 +2929,7 @@ SWIGINTERN PyObject *_wrap_Registry(PyObject *SWIGUNUSEDPARM(self), PyObject *ar }; arg3 = NULL; - { - arg4 = NULL; - } + arg4 = NULL; arg1 = NULL; arg2 = &tmp2; if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:Registry",kwnames,&obj0,&obj1)) SWIG_fail; @@ -3492,12 +3490,8 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar }; arg3 = NULL; - { - arg4 = NULL; - } - { - arg5 = loadparm_init(NULL); - } + arg4 = NULL; + arg5 = loadparm_init(NULL); arg1 = NULL; arg6 = &tmp6; if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOO:hive_key",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail; @@ -3573,12 +3567,8 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar }; arg3 = NULL; - { - arg4 = NULL; - } - { - arg5 = loadparm_init(NULL); - } + arg4 = NULL; + arg5 = loadparm_init(NULL); arg1 = NULL; arg6 = &tmp6; if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOO:open_ldb",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail; @@ -3730,13 +3720,9 @@ SWIGINTERN PyObject *_wrap_open_samba(PyObject *SWIGUNUSEDPARM(self), PyObject * (char *) "lp_ctx",(char *) "session_info",(char *) "credentials", NULL }; - { - arg3 = loadparm_init(NULL); - } + arg3 = loadparm_init(NULL); arg4 = NULL; - { - arg5 = NULL; - } + arg5 = NULL; arg1 = NULL; arg2 = &tmp2; if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:open_samba",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; diff --git a/source4/libcli/util/errors.i b/source4/libcli/util/errors.i index 3f6efda468..ec230a9c18 100644 --- a/source4/libcli/util/errors.i +++ b/source4/libcli/util/errors.i @@ -20,7 +20,7 @@ #ifdef SWIGPYTHON %typemap(out,noblock=1) WERROR { if (!W_ERROR_IS_OK($1)) { - PyObject *obj = Py_BuildValue("(i,s)", $1.v, win_errstr($1)); + PyObject *obj = Py_BuildValue("(i,s)", $1.v, (char *)win_errstr($1)); PyErr_SetObject(PyExc_RuntimeError, obj); SWIG_fail; } else if ($result == NULL) { @@ -30,7 +30,7 @@ %typemap(out,noblock=1) NTSTATUS { if (NT_STATUS_IS_ERR($1)) { - PyObject *obj = Py_BuildValue("(i,s)", $1.v, nt_errstr($1)); + PyObject *obj = Py_BuildValue("(i,s)", $1.v, (char *)nt_errstr($1)); PyErr_SetObject(PyExc_RuntimeError, obj); SWIG_fail; } else if ($result == NULL) { diff --git a/source4/scripting/python/misc_wrap.c b/source4/scripting/python/misc_wrap.c index 0f36647487..03128c2e9e 100644 --- a/source4/scripting/python/misc_wrap.c +++ b/source4/scripting/python/misc_wrap.c @@ -2837,9 +2837,7 @@ SWIGINTERN PyObject *_wrap_ldb_set_credentials(PyObject *SWIGUNUSEDPARM(self), P (char *) "ldb",(char *) "creds", NULL }; - { - arg2 = NULL; - } + arg2 = NULL; if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:ldb_set_credentials",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { @@ -2914,9 +2912,7 @@ SWIGINTERN PyObject *_wrap_ldb_set_loadparm(PyObject *SWIGUNUSEDPARM(self), PyOb (char *) "ldb",(char *) "lp_ctx", NULL }; - { - arg2 = loadparm_init(NULL); - } + arg2 = loadparm_init(NULL); if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:ldb_set_loadparm",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { -- cgit