Autoconf has recently seen some effort to robustify configure tests
against picky GCC warning settings. There is quite a way to go yet, but
it may still be useful to move the OpenMPI configury in that direction,
too. So below is a patch that picks some low-hanging fruit on the way
to make
../ompi-trunk/configure -C CFLAGS='-W -Wall -Werror' \
CXXFLAGS='-W -Wall -Werror'
work better with GCC. Note that currently, the above will still produce
some wrong results, or may even fail one some systems; so it's really
just a first step in that direction.
Also please double-check the changes to Windows specific files -- I did
not test them in any way.
As a side effect, this patch fixes one typo in a comment, and one
underquoted pair of brackets that would make code from c_weak_symbols.m4
end up as
int main(int argc, char *argv);
in the configure script.
Cheers,
Ralf
Index: config/ompi_check_pthread_pids.m4
===================================================================
--- config/ompi_check_pthread_pids.m4 (revision 11225)
+++ config/ompi_check_pthread_pids.m4 (working copy)
@@ -44,7 +44,7 @@
#include <unistd.h>
#include <stdlib.h>
void *checkpid(void *arg);
-int main(int argc, char* argv[]) {
+int main() {
pthread_t thr;
int pid, retval;
pid = getpid();
Index: config/ompi_microsoft.m4
===================================================================
--- config/ompi_microsoft.m4 (revision 11225)
+++ config/ompi_microsoft.m4 (working copy)
@@ -39,7 +39,7 @@
AC_MSG_CHECKING(for working InterlockedCompareExchange)
AC_TRY_RUN( [#include <windows.h>
- int main( int argc, char** argv ) {
+ int main() {
LONG dest = 1, exchange = 0, comperand = 1;
SetErrorMode(SEM_FAILCRITICALERRORS);
InterlockedCompareExchange( &dest, exchange, comperand );
@@ -55,7 +55,7 @@
AC_MSG_CHECKING(for working InterlockedCompareExchangeAcquire)
AC_TRY_RUN( [#include <windows.h>
- int main( int argc, char** argv ) {
+ int main() {
LONG dest = 1, exchange = 0, comperand = 1;
SetErrorMode(SEM_FAILCRITICALERRORS);
InterlockedCompareExchangeAcquire( &dest, exchange,
comperand );
@@ -71,7 +71,7 @@
AC_MSG_CHECKING(for working InterlockedCompareExchangeRelease)
AC_TRY_RUN( [#include <windows.h>
- int main( int argc, char** argv ) {
+ int main() {
LONG dest = 1, exchange = 0, comperand = 1;
SetErrorMode(SEM_FAILCRITICALERRORS);
InterlockedCompareExchangeRelease( &dest, exchange,
comperand );
@@ -87,7 +87,7 @@
AC_MSG_CHECKING(for working InterlockedCompareExchange64)
AC_TRY_RUN( [#include <windows.h>
- int main( int argc, char** argv ) {
+ int main() {
LONGLONG dest = 1, exchange = 0, comperand = 1;
SetErrorMode(SEM_FAILCRITICALERRORS);
InterlockedCompareExchange64( &dest, exchange, comperand
);
Index: config/ompi_setup_libevent.m4
===================================================================
--- config/ompi_setup_libevent.m4 (revision 11225)
+++ config/ompi_setup_libevent.m4 (working copy)
@@ -225,7 +225,7 @@
#include <stdlib.h>
int
-main(int argc, char **argv)
+main()
{
int kq;
int n;
@@ -289,7 +289,7 @@
}
int
-main(int argc, char **argv)
+main()
{
int epfd;
Index: config/f77_get_value_true.m4
===================================================================
--- config/f77_get_value_true.m4 (revision 11225)
+++ config/f77_get_value_true.m4 (working copy)
@@ -56,7 +56,6 @@
void $ompi_print_logical_fn(ompi_fortran_logical_t * logical)
{
- int result = 0;
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
@@ -89,7 +88,7 @@
[happy=0])
if test "$happy" = "0" ; then
- AC_MSG_ERROR([Could not determine value of Fotran .TRUE..
Aborting.])
+ AC_MSG_ERROR([Could not determine value of Fortran .TRUE..
Aborting.])
fi
AS_IF([test "$cross_compiling" = "yes"],
Index: config/ompi_config_asm.m4
===================================================================
--- config/ompi_config_asm.m4 (revision 11225)
+++ config/ompi_config_asm.m4 (working copy)
@@ -211,7 +211,7 @@
}
#endif
int
-main(int argc, char *argv[[]])
+main()
{
gsym_test_func();
return 0;
Index: config/cxx_find_template_repository.m4
===================================================================
--- config/cxx_find_template_repository.m4 (revision 11225)
+++ config/cxx_find_template_repository.m4 (working copy)
@@ -91,7 +91,7 @@
}
int
-main(int argc, char *argv[])
+main()
{
foo<bar> var1(6);
foo< foo<bar> > var2(var1);
Index: config/c_weak_symbols.m4
===================================================================
--- config/c_weak_symbols.m4 (revision 11225)
+++ config/c_weak_symbols.m4 (working copy)
@@ -33,7 +33,7 @@
cat > conftest.c <<EOF
extern int fake(int i);
extern int real(int i);
-int main(int argc, char *argv[]) { return fake(3); }
+int main() { return fake(3); }
EOF
# Try the compile
Index: config/ompi_check_icc.m4
===================================================================
--- config/ompi_check_icc.m4 (revision 11225)
+++ config/ompi_check_icc.m4 (working copy)
@@ -36,7 +36,7 @@
va_end (arglist);
}
-int main (int argc, char * argv[])
+int main ()
{
FILE *f;
func (4711, "Help %d [%s]\n", 10, "ten");
Index: config/c_get_alignment.m4
===================================================================
--- config/c_get_alignment.m4 (revision 11225)
+++ config/c_get_alignment.m4 (working copy)
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <stdlib.h>
struct foo { char c; $1 x; };
-int main(int argc, char* argv[])
+int main()
{
struct foo *p = (struct foo *) malloc(sizeof(struct foo));
int diff;