Commit Graph

71 Commits (72123da59d81e8d11d12c5776eb767693bdfebf4)

Author SHA1 Message Date
Cyp d9a5af62ad Fix building on mac (should really work this time). Maybe fix building on windows, maybe not, no idea if it was the same issue. 2010-03-11 09:42:38 +01:00
Cyp 6360e80f25 Try to fix new build warnings and a build error on mac. 2010-03-10 22:55:24 +01:00
Cyp 05575109b5 Try to clean up includes, fix missing extern on declaration of DataHash[]. 2010-03-10 13:31:27 +01:00
Giel van Schijndel 60c55e4009 #undefine NOMINMAX before #defining it
Prevents warnings about #redefining previously #defined macros

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@9869 4a71c877-e1ca-e34f-864e-861f7616d084
2010-02-19 18:00:09 +01:00
Buginator 3a5f7d556b Use #define NOMINMAX to disable the min / max macros in windows.h
instead of r9562
The other option was to use (std::max) as in, you have ( ) around min/max



git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@9589 4a71c877-e1ca-e34f-864e-861f7616d084
2010-02-09 20:27:57 +01:00
Christian Ohm 55f12a5d52 Hurd build fixes.
Closes #969.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@8706 4a71c877-e1ca-e34f-864e-861f7616d084
2010-01-30 20:26:44 +01:00
Giel van Schijndel fbec26f8e1 Improve compile time code checking:
* Use a version of STATIC_ASSERT that can be used as part of expressions
  - Taken from the Linux kernel (<linux/kernel.h>)
 * Add macro WZ_ASSERT_ARRAY which (statically) asserts that the given variable is an array
  - the given array needs to have a compile-time defined size
  - pointers will fail this assertion
 * Verify that the expression given to ARRAY_SIZE is truly an array
  - verify this using WZ_ASSERT_ARRAY_EXPR
 * Catch & fix two coding errors resulting from wrong use of some macros
  - macros: sstrcpy and ARRAY_SIZE

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@8654 4a71c877-e1ca-e34f-864e-861f7616d084
2010-01-30 17:12:54 +01:00
Christian Ohm 429fb34bfb Check for alloca.h in configure instead of hardcoding it.
Patch from #817.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@8132 4a71c877-e1ca-e34f-864e-861f7616d084
2009-09-28 22:21:07 +02:00
Christian Ohm 732a030544 Undef _XOPEN_SOURCE before including config.h in wzglobal.h.
Override the system headers, since autoconf defines this when needed.
Fixes #544.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7874 4a71c877-e1ca-e34f-864e-861f7616d084
2009-09-27 19:06:36 +02:00
Giel van Schijndel 7bb1474692 FreeBSD #defines alloca() in <stdlib.h>, not <alloc.h> (that's a Linux/glibc thing), so make the #included file platform dependent
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7538 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-28 09:59:29 +02:00
Giel van Schijndel 2bca3018f4 Make sure that WZ_ASSERT_STATIC_STRING works properly in C++ as well
In fact, WZ_ASSERT_STATIC_STRING should now work on ''all'' valid C++ compilers.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6930 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-03 18:53:11 +02:00
Dennis Schridde ffcf206972 MSVC supports noreturn as well
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6780 4a71c877-e1ca-e34f-864e-861f7616d084
2009-03-06 14:52:22 +00:00
Dennis Schridde 6c1bafbf77 Use macro to check for MSVC .NET
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6778 4a71c877-e1ca-e34f-864e-861f7616d084
2009-03-06 14:40:19 +00:00
Dennis Schridde c0acc342bb Add more documentation to WZ_DECL_*, use __ attribute names as recommended by GNU for headers, reorder defintions logically
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6777 4a71c877-e1ca-e34f-864e-861f7616d084
2009-03-06 14:40:08 +00:00
Dennis Schridde 4c3053b3e1 "restrict" is a C99 feature, thus use the appropriate checks
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6776 4a71c877-e1ca-e34f-864e-861f7616d084
2009-03-06 14:39:59 +00:00
Dennis Schridde 8aacce716c Provide noreturn declaration macro (useful for exit-on-failure functions)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6775 4a71c877-e1ca-e34f-864e-861f7616d084
2009-03-06 14:39:19 +00:00
Dennis Schridde aac41748dc Bump copyright
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6617 4a71c877-e1ca-e34f-864e-861f7616d084
2009-02-10 18:01:48 +00:00
Dennis Schridde 8050b17162 Cleanup
Incl: Move MAX_STR_LENGTH out of wzglobal.h, since it is only used in src

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6612 4a71c877-e1ca-e34f-864e-861f7616d084
2009-02-10 17:23:03 +00:00
Dennis Schridde df6bd00d7e Provide fmaxf() / fminf() for non C99 compilers
Fixes #234.
This is not the patch attached there, since that one was broken.

From the manpage:
DESCRIPTION
       These functions return the larger value of x and y.
RETURN VALUE
       These functions return the maximum of x and y.
       If one argument is a NaN, the other argument is returned.
       If both arguments are NaN, a NaN is returned.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6601 4a71c877-e1ca-e34f-864e-861f7616d084
2009-02-09 03:53:08 +00:00
Dennis Schridde e88fb88376 Detect C++98 and do not mix feature detection code with platform hacks (!!)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6571 4a71c877-e1ca-e34f-864e-861f7616d084
2009-01-31 15:51:43 +00:00
Giel van Schijndel fc808a8c89 Only #define va_copy if it isn't #defined yet
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6367 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-23 17:24:48 +00:00
Giel van Schijndel 11e378ccce Allow WZ_ASSERT_STATIC_STRING to work when compiled as C++ as well
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6262 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-09 23:49:39 +00:00
Per Inge Mathisen be263e0b8c Fix missing define of WZ_DECL_THREAD on windows
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5991 4a71c877-e1ca-e34f-864e-861f7616d084
2008-09-11 18:16:06 +00:00
Giel van Schijndel 37c6b31651 * When using a va_list multiple times make sure to va_copy it first
* Because va_copy is C99 provide a fallback for it on non-C99 systems (which assumes that va_list is just a pointer to the stack)

This fixes ticket:50, thanks to Buginator for finding the cause (though this solution is different from his suggestion)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5930 4a71c877-e1ca-e34f-864e-861f7616d084
2008-09-05 19:38:22 +00:00
Giel van Schijndel 5e593ad615 Add platform detection code for GNU/kFreeBSD (OS with FreeBSD kernel and GNU utilities and libraries) to allow compiling on this system
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5794 4a71c877-e1ca-e34f-864e-861f7616d084
2008-08-11 15:29:44 +00:00
Roman C b40f5dd5a3 Get rid of some more compiler warnings on MSVC.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5032 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-11 10:17:49 +00:00
Roman C 2c7d52d0c8 Fix MSVC compilation.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4914 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-04 12:55:05 +00:00
Per Inge Mathisen 221a2cb4ee Remove MSVC support for WZ_DECL_CONST since it didn't work.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4913 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-04 12:34:20 +00:00
Per Inge Mathisen 6e9732a86a WZ_DECL_CONST now implies WZ_DECL_WARN_UNUSED_RESULT and also works on MSVC.
WZ_DECL_RESTRICT now works on MSVC as well.
WZ_DECL_THREAD added, declares variables thread local, support for it made mandatory.
WZ_ASSERT_STATIC_STRING (gcc only) to assert that a string is static added.
The sstr functions now support pointer-length strings again.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4908 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-04 11:43:28 +00:00
Roman C c3ace2ec9f Redefine __STDC__ to 1, this fixes MSVC compilation.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4855 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-29 15:05:08 +00:00
Giel van Schijndel b047f2c1ef Work around MSVC not #defining __STDC__ (all ISO C89 compliant compiles _should_ #define that macro)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4854 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-29 14:32:14 +00:00
Giel van Schijndel c6a0ad011e restrict is not a keyword to C++, so don't use it when compiling as C++
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4615 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-14 21:39:14 +00:00
Per Inge Mathisen b41b7358b7 Add safer, proven versions of strlcpy and strlcat from OpenBSD.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4483 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-05 11:45:29 +00:00
Giel van Schijndel 57389641e7 Remove the last content of deliverance.h (#define MAX_STR_LENGTH 256) to wzglobal.h and remove it
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4219 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-21 23:02:22 +00:00
Dennis Schridde 9ca4445189 We always only have either config.h or config-macosx.h, but not both.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4207 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-21 16:38:57 +00:00
Dennis Schridde 303895e5fb Mark all BASE_OBJECT "derived" types as WZ_DECL_MAY_ALIAS (they may alias with any type).
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4011 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-11 15:53:45 +00:00
Per Inge Mathisen 916435094f Add message to MSVC users about disabled warnings. Patch #995 from Buginator.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3967 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-09 10:06:05 +00:00
Dennis Schridde 056147b16d Oh my beauty...
Please don't clutter the detection code with platform specific fixes... That's what the /* ---- Platform specific setup ---- */ section is for...


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3948 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-07 21:51:53 +00:00
Per Inge Mathisen dfad738d65 Fix most MSVC warnings.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3947 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-07 19:26:19 +00:00
Per Inge Mathisen b4ef4d4349 Add new function attribute WZ_DECL_WARN_UNUSED_RETURN and use it on IdToDroid,
whose return must be checked, and fix one bug already detected by it.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3260 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-30 21:44:14 +00:00
Dennis Schridde 248a8cb510 Minor indent
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3170 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-24 22:05:15 +00:00
Giel van Schijndel 798d10c6d8 * Guarantee that PATH_MAX is large enough to use as the size for Windows API calls (since with MinGW it is 159 bytes while it should be 160)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3136 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-23 16:44:36 +00:00
Giel van Schijndel 7711572f0a * Add a new module (printf_ext.c) to contain some printf extensions (C99 printf variants for MSVC)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2803 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-11 20:58:10 +00:00
Giel van Schijndel a08e6f07f8 * Provide alloca() on GCC, MinGW and MSVC (and all other WZ_OS_UNIX compilers that provide <alloca.h>
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2801 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-11 20:04:50 +00:00
Dennis Schridde 1dd2b54431 wzglobal.h never belonged to Eidos. Instead large parts of the code are copied from Qt and thus belong to Trolltech.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2776 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-10 13:25:02 +00:00
Dennis Schridde 5ccaa17971 Correct WZ_CC_TINYC check. (Note the namechange!)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2775 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-10 12:10:54 +00:00
Dennis Schridde 3a56a479b3 - Extend compiler detection with TinyCC
- Add window system detection
- Remove MSDOS from supported OSes


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2771 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-10 00:31:43 +00:00
Giel van Schijndel 96d5054729 * Make sure to #include <stdio.h> when compiling on MSVC so that those inline replacements for snprintf and vsnprintf will actually compile....
* Lets terminate statements with a semi-colon!!


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2745 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-06 18:36:37 +00:00
Giel van Schijndel 7b2530306c * On MSVC make sure to #define inline __before__ using it!!
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2744 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-06 18:30:19 +00:00
Giel van Schijndel 92e013e406 * Add static inline functions vsnprintf and snprintf when compiling with MSVC
* These functions comply to the C99 specification and return the amount of characters they would have written if no truncation occurred
Slightly modified form of patch file #3146 attached to bug #10269 by Buginator; applied the changes of this patch to wzglobal.h instead of version.c


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2742 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-06 14:07:50 +00:00