summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-03-14 21:58:48 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-03-14 21:58:48 +0000
commit8ef41dcb207514cab2ef5683be26f53091bb94a6 (patch)
tree6683e7f17636acf3e9b492e947d0a0f08caa76bb
parent095a6f2fb2b290ef133f5c3818e6314b4f71f956 (diff)
downloadnuttx-8ef41dcb207514cab2ef5683be26f53091bb94a6.tar.gz
nuttx-8ef41dcb207514cab2ef5683be26f53091bb94a6.tar.bz2
nuttx-8ef41dcb207514cab2ef5683be26f53091bb94a6.zip
Changes for clean compilation with ZDS
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1610 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/examples/poll/Makefile.host6
-rw-r--r--nuttx/examples/poll/net_listener.c8
-rw-r--r--nuttx/examples/poll/net_reader.c6
-rw-r--r--nuttx/examples/poll/poll_internal.h25
-rw-r--r--nuttx/examples/poll/select_listener.c4
5 files changed, 34 insertions, 15 deletions
diff --git a/nuttx/examples/poll/Makefile.host b/nuttx/examples/poll/Makefile.host
index 90a448e92..151400efc 100644
--- a/nuttx/examples/poll/Makefile.host
+++ b/nuttx/examples/poll/Makefile.host
@@ -1,7 +1,7 @@
############################################################################
# examples/poll/Makefile.host
#
-# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
@@ -41,9 +41,9 @@ BIN = host
DEFINES = -DTARGETIP=\"$(TARGETIP)\"
-all: $(BIN)$(EXEEXT)
+all: $(BIN)
-$(BIN)$(EXEEXT): $(SRC)
+$(BIN): $(SRC)
$(HOSTCC) $(HOSTCFLAGS) $(DEFINES) $^ -o $@
clean:
diff --git a/nuttx/examples/poll/net_listener.c b/nuttx/examples/poll/net_listener.c
index 957f48fc0..fbb70f4bd 100644
--- a/nuttx/examples/poll/net_listener.c
+++ b/nuttx/examples/poll/net_listener.c
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/poll/net_listener.c
*
- * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -52,7 +52,9 @@
#include <errno.h>
#include <debug.h>
+#include <net/if.h>
#include <net/uip/uip-lib.h>
+
#include "poll_internal.h"
/****************************************************************************
@@ -165,6 +167,7 @@ static inline boolean net_incomingdata(struct net_listener_s *nls, int sd)
}
}
}
+ return 0;
}
/****************************************************************************
@@ -207,6 +210,7 @@ static inline boolean net_connection(struct net_listener_s *nls)
return TRUE;
}
}
+ return FALSE;
}
/****************************************************************************
@@ -367,7 +371,7 @@ void *net_listener(pthread_addr_t pvarg)
message("net_listener: Calling select(), listener sd=%d\n", nls.listensd);
memcpy(&nls.working, &nls.master, sizeof(fd_set));
- ret = select(nls.mxsd + 1, &nls.working, NULL, NULL, &timeout);
+ ret = select(nls.mxsd + 1, (FAR fd_set*)&nls.working, (FAR fd_set*)NULL, (FAR fd_set*)NULL, &timeout);
if (ret < 0)
{
message("net_listener: select failed: %d\n", errno);
diff --git a/nuttx/examples/poll/net_reader.c b/nuttx/examples/poll/net_reader.c
index cdddca790..ca1fa4bb0 100644
--- a/nuttx/examples/poll/net_reader.c
+++ b/nuttx/examples/poll/net_reader.c
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/poll/net_reader.c
*
- * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -52,7 +52,9 @@
#include <errno.h>
#include <debug.h>
+#include <net/if.h>
#include <net/uip/uip-lib.h>
+
#include "poll_internal.h"
/****************************************************************************
@@ -141,7 +143,7 @@ static void net_receive(int sd)
{
FD_ZERO(&readset);
FD_SET(sd, &readset);
- ret = select(sd + 1, &readset, NULL, NULL, &timeout);
+ ret = select(sd + 1, (FAR fd_set*)&readset, (FAR fd_set*)NULL, (FAR fd_set*)NULL, &timeout);
}
while (ret < 0 && errno == EINTR);
diff --git a/nuttx/examples/poll/poll_internal.h b/nuttx/examples/poll/poll_internal.h
index 38a5e0f7e..cbf42ac56 100644
--- a/nuttx/examples/poll/poll_internal.h
+++ b/nuttx/examples/poll/poll_internal.h
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/poll/poll_internal.h
*
- * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -73,14 +73,27 @@
/* If debug is enabled, then use lib_rawprintf so that OS debug output and
* the test output are synchronized.
+ *
+ * These macros will differ depending upon if the toolchain supports
+ * macros with a variable number of arguments or not.
*/
-#ifdef CONFIG_DEBUG
-# define message(...) lib_rawprintf(__VA_ARGS__)
-# define msgflush()
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_rawprintf(__VA_ARGS__)
+# define msgflush()
+# else
+# define message(...) printf(__VA_ARGS__)
+# define msgflush() fflush(stdout)
+# endif
#else
-# define message(...) printf(__VA_ARGS__)
-# define msgflush() fflush(stdout)
+# ifdef CONFIG_DEBUG
+# define message lib_rawprintf
+# define msgflush()
+# else
+# define message printf
+# define msgflush() fflush(stdout)
+# endif
#endif
#define FIFO_PATH1 "/dev/fifo0"
diff --git a/nuttx/examples/poll/select_listener.c b/nuttx/examples/poll/select_listener.c
index a9b31465c..85ff57a5e 100644
--- a/nuttx/examples/poll/select_listener.c
+++ b/nuttx/examples/poll/select_listener.c
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/poll/select_listener.c
*
- * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -115,7 +115,7 @@ void *select_listener(pthread_addr_t pvarg)
timeout = FALSE;
ready = FALSE;
- ret = select(fd+1, &rfds, NULL, NULL, &tv);
+ ret = select(fd+1, (FAR fd_set*)&rfds, (FAR fd_set*)NULL, (FAR fd_set*)NULL, &tv);
message("\nselect_listener: select returned: %d\n", ret);
if (ret < 0)