1
0

checksparse.sh 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. #!/bin/sh
  2. # Copyright (c) 2013, Ben Noordhuis <info@bnoordhuis.nl>
  3. #
  4. # Permission to use, copy, modify, and/or distribute this software for any
  5. # purpose with or without fee is hereby granted, provided that the above
  6. # copyright notice and this permission notice appear in all copies.
  7. #
  8. # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. SPARSE=${SPARSE:-sparse}
  16. SPARSE_FLAGS=${SPARSE_FLAGS:-"
  17. -D__POSIX__
  18. -Wsparse-all
  19. -Wno-do-while
  20. -Wno-transparent-union
  21. -Iinclude
  22. -Iinclude/uv-private
  23. -Isrc
  24. "}
  25. SOURCES="
  26. include/uv-private/ngx-queue.h
  27. include/uv-private/tree.h
  28. include/uv-private/uv-unix.h
  29. include/uv.h
  30. src/fs-poll.c
  31. src/inet.c
  32. src/unix/async.c
  33. src/unix/core.c
  34. src/unix/dl.c
  35. src/unix/error.c
  36. src/unix/fs.c
  37. src/unix/getaddrinfo.c
  38. src/unix/internal.h
  39. src/unix/loop-watcher.c
  40. src/unix/loop.c
  41. src/unix/pipe.c
  42. src/unix/poll.c
  43. src/unix/process.c
  44. src/unix/signal.c
  45. src/unix/stream.c
  46. src/unix/tcp.c
  47. src/unix/thread.c
  48. src/unix/threadpool.c
  49. src/unix/timer.c
  50. src/unix/tty.c
  51. src/unix/udp.c
  52. src/uv-common.c
  53. src/uv-common.h
  54. "
  55. TESTS="
  56. test/benchmark-async-pummel.c
  57. test/benchmark-async.c
  58. test/benchmark-fs-stat.c
  59. test/benchmark-getaddrinfo.c
  60. test/benchmark-loop-count.c
  61. test/benchmark-million-async.c
  62. test/benchmark-million-timers.c
  63. test/benchmark-multi-accept.c
  64. test/benchmark-ping-pongs.c
  65. test/benchmark-pound.c
  66. test/benchmark-pump.c
  67. test/benchmark-sizes.c
  68. test/benchmark-spawn.c
  69. test/benchmark-tcp-write-batch.c
  70. test/benchmark-thread.c
  71. test/benchmark-udp-pummel.c
  72. test/blackhole-server.c
  73. test/dns-server.c
  74. test/echo-server.c
  75. test/run-benchmarks.c
  76. test/run-tests.c
  77. test/runner-unix.c
  78. test/runner-unix.h
  79. test/runner.c
  80. test/runner.h
  81. test/task.h
  82. test/test-active.c
  83. test/test-async.c
  84. test/test-barrier.c
  85. test/test-callback-order.c
  86. test/test-callback-stack.c
  87. test/test-condvar.c
  88. test/test-connection-fail.c
  89. test/test-cwd-and-chdir.c
  90. test/test-delayed-accept.c
  91. test/test-dlerror.c
  92. test/test-embed.c
  93. test/test-error.c
  94. test/test-fail-always.c
  95. test/test-fs-event.c
  96. test/test-fs-poll.c
  97. test/test-fs.c
  98. test/test-get-currentexe.c
  99. test/test-get-loadavg.c
  100. test/test-get-memory.c
  101. test/test-getaddrinfo.c
  102. test/test-getsockname.c
  103. test/test-hrtime.c
  104. test/test-idle.c
  105. test/test-ipc-send-recv.c
  106. test/test-ipc.c
  107. test/test-loop-handles.c
  108. test/test-multiple-listen.c
  109. test/test-mutexes.c
  110. test/test-pass-always.c
  111. test/test-ping-pong.c
  112. test/test-pipe-bind-error.c
  113. test/test-pipe-connect-error.c
  114. test/test-platform-output.c
  115. test/test-poll-close.c
  116. test/test-poll.c
  117. test/test-process-title.c
  118. test/test-ref.c
  119. test/test-run-nowait.c
  120. test/test-run-once.c
  121. test/test-semaphore.c
  122. test/test-shutdown-close.c
  123. test/test-shutdown-eof.c
  124. test/test-signal-multiple-loops.c
  125. test/test-signal.c
  126. test/test-spawn.c
  127. test/test-stdio-over-pipes.c
  128. test/test-tcp-bind-error.c
  129. test/test-tcp-bind6-error.c
  130. test/test-tcp-close-while-connecting.c
  131. test/test-tcp-close.c
  132. test/test-tcp-connect-error-after-write.c
  133. test/test-tcp-connect-error.c
  134. test/test-tcp-connect-timeout.c
  135. test/test-tcp-connect6-error.c
  136. test/test-tcp-flags.c
  137. test/test-tcp-open.c
  138. test/test-tcp-read-stop.c
  139. test/test-tcp-shutdown-after-write.c
  140. test/test-tcp-unexpected-read.c
  141. test/test-tcp-write-error.c
  142. test/test-tcp-write-to-half-open-connection.c
  143. test/test-tcp-writealot.c
  144. test/test-thread.c
  145. test/test-threadpool-cancel.c
  146. test/test-threadpool.c
  147. test/test-timer-again.c
  148. test/test-timer.c
  149. test/test-tty.c
  150. test/test-udp-dgram-too-big.c
  151. test/test-udp-ipv6.c
  152. test/test-udp-multicast-join.c
  153. test/test-udp-multicast-ttl.c
  154. test/test-udp-open.c
  155. test/test-udp-options.c
  156. test/test-udp-send-and-recv.c
  157. test/test-util.c
  158. test/test-walk-handles.c
  159. "
  160. case `uname -s` in
  161. AIX)
  162. SPARSE_FLAGS="$SPARSE_FLAGS -D_AIX=1"
  163. SOURCES="$SOURCES
  164. src/unix/aix.c"
  165. ;;
  166. Darwin)
  167. SPARSE_FLAGS="$SPARSE_FLAGS -D__APPLE__=1"
  168. SOURCES="$SOURCES
  169. include/uv-private/uv-bsd.h
  170. src/unix/darwin.c
  171. src/unix/kqueue.c
  172. src/unix/fsevents.c"
  173. ;;
  174. DragonFly)
  175. SPARSE_FLAGS="$SPARSE_FLAGS -D__DragonFly__=1"
  176. SOURCES="$SOURCES
  177. include/uv-private/uv-bsd.h
  178. src/unix/kqueue.c
  179. src/unix/freebsd.c"
  180. ;;
  181. FreeBSD)
  182. SPARSE_FLAGS="$SPARSE_FLAGS -D__FreeBSD__=1"
  183. SOURCES="$SOURCES
  184. include/uv-private/uv-bsd.h
  185. src/unix/kqueue.c
  186. src/unix/freebsd.c"
  187. ;;
  188. Linux)
  189. SPARSE_FLAGS="$SPARSE_FLAGS -D__linux__=1"
  190. SOURCES="$SOURCES
  191. include/uv-private/uv-linux.h
  192. src/unix/linux-inotify.c
  193. src/unix/linux-core.c
  194. src/unix/linux-syscalls.c
  195. src/unix/linux-syscalls.h"
  196. ;;
  197. NetBSD)
  198. SPARSE_FLAGS="$SPARSE_FLAGS -D__NetBSD__=1"
  199. SOURCES="$SOURCES
  200. include/uv-private/uv-bsd.h
  201. src/unix/kqueue.c
  202. src/unix/netbsd.c"
  203. ;;
  204. OpenBSD)
  205. SPARSE_FLAGS="$SPARSE_FLAGS -D__OpenBSD__=1"
  206. SOURCES="$SOURCES
  207. include/uv-private/uv-bsd.h
  208. src/unix/kqueue.c
  209. src/unix/openbsd.c"
  210. ;;
  211. SunOS)
  212. SPARSE_FLAGS="$SPARSE_FLAGS -D__sun=1"
  213. SOURCES="$SOURCES
  214. include/uv-private/uv-sunos.h
  215. src/unix/sunos.c"
  216. ;;
  217. esac
  218. for ARCH in __i386__ __x86_64__ __arm__; do
  219. $SPARSE $SPARSE_FLAGS -D$ARCH=1 $SOURCES
  220. done
  221. # Tests are architecture independent.
  222. $SPARSE $SPARSE_FLAGS -Itest $TESTS