From 566a24d6ee26ca3ed419a1944a690acd00e06426 Mon Sep 17 00:00:00 2001 From: skidd13 Date: Sun, 30 Dec 2007 19:32:09 +0000 Subject: [PATCH] (svn r11723) -Feature: add initial support for Intel C Compiler on linux -Codechange: silence a few warnings of ICC --- config.lib | 110 ++++++++++++++++++++++++++++----------------------- src/rail.cpp | 10 ++--- 2 files changed, 65 insertions(+), 55 deletions(-) diff --git a/config.lib b/config.lib index 46630338ff..b7e47bb707 100644 --- a/config.lib +++ b/config.lib @@ -829,66 +829,76 @@ make_cflags_and_ldflags() { CFLAGS="$CFLAGS -DNO_THREADS" fi - # Enable some things only for certain GCC versions - cc_version=`$cc_host -dumpversion | cut -c 1,3` + if [ `echo $cc_host | cut -c 1-3` = "icc" ]; then + # Enable some things only for certain ICC versions + cc_version=`$cc_host -dumpversion | cut -c 1-4` - if [ $cc_version -ge 29 ]; then - CFLAGS="$CFLAGS -Wall -Wno-multichar -Wsign-compare -Wundef" - CFLAGS="$CFLAGS -Wwrite-strings -Wpointer-arith" - CFLAGS="$CFLAGS -Wno-uninitialized" - CC_CFLAGS="$CC_CFLAGS -Wstrict-prototypes" - fi + if [ "$cc_version" = "10.1" ]; then + CFLAGS="$CFLAGS -Wno-multichar" + fi + else + # Enable some things only for certain GCC versions + cc_version=`$cc_host -dumpversion | cut -c 1,3` - gcc295="" - if [ "$cc_version" = 29 ]; then - # Make sure we mark GCC 2.95 flag for Makefile.src.in, as we - # need a lovely hack there to make it compile correctly. - gcc295="1" - fi + if [ $cc_version -ge 29 ]; then + CFLAGS="$CFLAGS -Wall -Wno-multichar -Wsign-compare -Wundef" + CFLAGS="$CFLAGS -Wwrite-strings -Wpointer-arith" + CFLAGS="$CFLAGS -Wno-uninitialized" - if [ $cc_version -ge 30 ]; then - CFLAGS="$CFLAGS -W -Wno-unused-parameter" - fi + CC_CFLAGS="$CC_CFLAGS -Wstrict-prototypes" + fi - if [ $cc_version -ge 34 ]; then - CC_CFLAGS="$CC_CFLAGS -Wdeclaration-after-statement -Wold-style-definition" - fi + gcc295="" + if [ "$cc_version" = 29 ]; then + # Make sure we mark GCC 2.95 flag for Makefile.src.in, as we + # need a lovely hack there to make it compile correctly. + gcc295="1" + fi - if [ "$os" = "CYGWIN" ]; then - CFLAGS="$CFLAGS -mwin32" - LDFLAGS="$LDFLAGS -mwin32" - fi - if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then - CFLAGS="$CFLAGS -mno-cygwin" - LDFLAGS="$LDFLAGS -mno-cygwin" - fi + if [ $cc_version -ge 30 ]; then + CFLAGS="$CFLAGS -W -Wno-unused-parameter" + fi - if [ "$os" = "CYGWIN" ] || [ "$os" = "MINGW" ]; then - LDFLAGS="$LDFLAGS -Wl,--subsystem,windows" - LIBS="$LIBS -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32" - fi + if [ $cc_version -ge 34 ]; then + CC_CFLAGS="$CC_CFLAGS -Wdeclaration-after-statement -Wold-style-definition" + fi - # GCC 4.0+ complains about that we break strict-aliasing. - # On most places we don't see how to fix it, and it doesn't - # break anything. So disable strict-aliasing to make the - # compiler all happy. - if [ $cc_version -ge 40 ]; then - CFLAGS="$CFLAGS -fno-strict-aliasing" - fi + if [ "$os" = "CYGWIN" ]; then + CFLAGS="$CFLAGS -mwin32" + LDFLAGS="$LDFLAGS -mwin32" + fi + if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then + CFLAGS="$CFLAGS -mno-cygwin" + LDFLAGS="$LDFLAGS -mno-cygwin" + fi - # GCC 4.2+ automatically assumes that signed overflows do - # not occur in signed arithmetics, whereas we are not - # sure that they will not happen. It furthermore complains - # about it's own optimized code in some places. - if [ $cc_version -ge 42 ]; then - CFLAGS="$CFLAGS -fno-strict-overflow" - fi + if [ "$os" = "CYGWIN" ] || [ "$os" = "MINGW" ]; then + LDFLAGS="$LDFLAGS -Wl,--subsystem,windows" + LIBS="$LIBS -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32" + fi - # GCC 4.3+ gives a warning about empty body of - # loops and conditions - if [ $cc_version -ge 43 ]; then - CFLAGS="$CFLAGS -Wno-empty-body" + # GCC 4.0+ complains about that we break strict-aliasing. + # On most places we don't see how to fix it, and it doesn't + # break anything. So disable strict-aliasing to make the + # compiler all happy. + if [ $cc_version -ge 40 ]; then + CFLAGS="$CFLAGS -fno-strict-aliasing" + fi + + # GCC 4.2+ automatically assumes that signed overflows do + # not occur in signed arithmetics, whereas we are not + # sure that they will not happen. It furthermore complains + # about it's own optimized code in some places. + if [ $cc_version -ge 42 ]; then + CFLAGS="$CFLAGS -fno-strict-overflow" + fi + + # GCC 4.3+ gives a warning about empty body of + # loops and conditions + if [ $cc_version -ge 43 ]; then + CFLAGS="$CFLAGS -Wno-empty-body" + fi fi if [ "$os" != "CYGWIN" ] && [ "$os" != "FREEBSD" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ] && [ "$os" != "OS2" ]; then diff --git a/src/rail.cpp b/src/rail.cpp index ba5228ee50..ea8a78de3e 100644 --- a/src/rail.cpp +++ b/src/rail.cpp @@ -14,14 +14,14 @@ /* XXX: Below 3 tables store duplicate data. Maybe remove some? */ /* Maps a trackdir to the bit that stores its status in the map arrays, in the * direction along with the trackdir */ -extern const byte _signal_along_trackdir[] = { +extern const byte _signal_along_trackdir[TRACKDIR_END] = { 0x8, 0x8, 0x8, 0x2, 0x4, 0x1, 0, 0, 0x4, 0x4, 0x4, 0x1, 0x8, 0x2 }; /* Maps a trackdir to the bit that stores its status in the map arrays, in the * direction against the trackdir */ -extern const byte _signal_against_trackdir[] = { +extern const byte _signal_against_trackdir[TRACKDIR_END] = { 0x4, 0x4, 0x4, 0x1, 0x8, 0x2, 0, 0, 0x8, 0x8, 0x8, 0x2, 0x4, 0x1 }; @@ -42,13 +42,13 @@ extern const TrackdirBits _exitdir_reaches_trackdirs[] = { TRACKDIR_BIT_Y_NW | TRACKDIR_BIT_RIGHT_N | TRACKDIR_BIT_LOWER_W /* DIAGDIR_NW */ }; -extern const Trackdir _next_trackdir[] = { +extern const Trackdir _next_trackdir[TRACKDIR_END] = { TRACKDIR_X_NE, TRACKDIR_Y_SE, TRACKDIR_LOWER_E, TRACKDIR_UPPER_E, TRACKDIR_RIGHT_S, TRACKDIR_LEFT_S, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_X_SW, TRACKDIR_Y_NW, TRACKDIR_LOWER_W, TRACKDIR_UPPER_W, TRACKDIR_RIGHT_N, TRACKDIR_LEFT_N }; /* Maps a trackdir to all trackdirs that make 90 deg turns with it. */ -extern const TrackdirBits _track_crosses_trackdirs[] = { +extern const TrackdirBits _track_crosses_trackdirs[TRACKDIR_END] = { TRACKDIR_BIT_Y_SE | TRACKDIR_BIT_Y_NW, /* TRACK_X */ TRACKDIR_BIT_X_NE | TRACKDIR_BIT_X_SW, /* TRACK_Y */ TRACKDIR_BIT_RIGHT_N | TRACKDIR_BIT_RIGHT_S | TRACKDIR_BIT_LEFT_N | TRACKDIR_BIT_LEFT_S, /* TRACK_UPPER */ @@ -69,7 +69,7 @@ extern const TrackBits _track_crosses_tracks[] = { /* Maps a trackdir to the (4-way) direction the tile is exited when following * that trackdir */ -extern const DiagDirection _trackdir_to_exitdir[] = { +extern const DiagDirection _trackdir_to_exitdir[TRACKDIR_END] = { DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_SW, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_NE, DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NW, DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NE, };