--- deliantra/server/include/util.h 2007/05/26 15:44:05 1.45 +++ deliantra/server/include/util.h 2007/06/02 03:48:29 1.47 @@ -1,3 +1,25 @@ +/* + * This file is part of Crossfire TRT, the Multiplayer Online Role Playing Game. + * + * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team + * + * Crossfire TRT is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * The authors can be reached via e-mail to + */ + #ifndef UTIL_H__ #define UTIL_H__ @@ -13,6 +35,10 @@ # define prefetch(addr,rw,locality) #endif +#if __GNUC__ < 4 || (__GNUC__ == 4 || __GNUC_MINOR__ < 4) +# define decltype(x) typeof(x) +#endif + // put into ifs if you are very sure that the expression // is mostly true or mosty false. note that these return // booleans, not the expression. @@ -30,7 +56,7 @@ #include // use a gcc extension for auto declarations until ISO C++ sanctifies them -#define auto(var,expr) typeof(expr) var = (expr) +#define auto(var,expr) decltype(expr) var = (expr) // very ugly macro that basicaly declares and initialises a variable // that is in scope for the next statement only