From: Stephen D. <sd...@us...> - 2005-06-10 07:29:30
|
Update of /cvsroot/naviserver/naviserver/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14038/include Modified Files: Makefile.global.in nsthread.h Added Files: nscheck.h Log Message: * include/Makefile.global.in: Enable Tcl CONST checking. * include/nsthread.h: * include/nscheck.h: Add support for extra GCC checks. (RFE #1215725) --- NEW FILE: nscheck.h --- /* * The contents of this file are subject to the AOLserver Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://aolserver.com/. * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. * * The Original Code is AOLserver Code and related documentation * distributed by AOL. * * The Initial Developer of the Original Code is America Online, * Inc. Portions created by AOL are Copyright (C) 1999 America Online, * Inc. All Rights Reserved. * * Alternatively, the contents of this file may be used under the terms * of the GNU General Public License (the "GPL"), in which case the * provisions of GPL are applicable instead of those above. If you wish * to allow use of your version of this file only under the terms of the * GPL and not to allow others to use your version of this file under the * License, indicate your decision by deleting the provisions above and * replace them with the notice and other provisions required by the GPL. * If you do not delete the provisions above, a recipient may use your * version of this file under either the License or the GPL. */ /* * nscheck.h -- * * Stronger compile time error checking when using GCC. * * $Header: /cvsroot/naviserver/naviserver/include/nscheck.h,v 1.1 2005/06/10 07:29:19 sdeasey Exp $ */ #ifndef NSCHECK_H #define NSCHECK_H #undef __GNUC_PREREQ #if defined __GNUC__ && defined __GNUC_MINOR__ # define __GNUC_PREREQ(maj, min) \ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) #endif #if __GNUC_PREREQ(2,96) # define NS_GNUC_MALLOC __attribute__((__malloc__)) # define NS_GNUC_PURE __attribute__((__pure__)) # define NS_GNUC_CONST __attribute__((__const__)) #else # define NS_GNUC_MALLOC # define NS_GNUC_PURE # define NS_GNUC_CONST #endif #if __GNUC_PREREQ(2,7) # define NS_GNUC_UNUSED __attribute__((__unused__)) # define NS_GNUC_NORETURN __attribute__((__noreturn__)) # define NS_GNUC_PRINTF(fmtarg, firstvararg) \ __attribute__((__format__ (__printf__, fmtarg, firstvararg))) # define NS_GNUC_SCANF(fmtarg, firstvararg) \ __attribute__((__format__ (__scanf__, fmtarg, firstvararg))) #else # define NS_GNUC_UNUSED # define NS_GNUC_NORETURN # define NS_GNUC_PRINTF(fmtarg, firstvararg) # define NS_GNUC_SCANF(fmtarg, firstvararg) #endif #if __GNUC_PREREQ(2,8) # define NS_GNUC_FORMAT(fmtarg) __attribute__((__format_arg__ (fmtarg))) #else # define NS_GNUC_FORMAT(fmtarg) #endif #if __GNUC_PREREQ(3,1) # define NS_GNUC_USED __attribute__((__used__)) #else # define NS_GNUC_USED #endif #if __GNUC_PREREQ(3,2) # define NS_GNUC_DEPRECATED __attribute__((__deprecated__)) #else # define NS_GNUC_DEPRECATED #endif #if __GNUC_PREREQ(3,3) # define NS_GNUC_NONNULL(...) __attribute__((__nonnull__(__VA_ARGS__))) # define NS_GNUC_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) # define NS_GNUC_MAYALIAS __attribute__((__may_alias__)) #else # define NS_GNUC_NONNULL(...) # define NS_GNUC_WARN_UNUSED_RESULT # define NS_GNUC_MAYALIAS #endif /* * Ensure static RCSID strings aren't optimised away. */ #define NS_RCSID(string) static const char *RCSID NS_GNUC_USED = string \ ", compiled: " __DATE__ " " __TIME__ #endif /* NSCHECK_H */ Index: Makefile.global.in =================================================================== RCS file: /cvsroot/naviserver/naviserver/include/Makefile.global.in,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Makefile.global.in 10 Jun 2005 02:42:19 -0000 1.10 --- Makefile.global.in 10 Jun 2005 07:29:19 -0000 1.11 *************** *** 71,75 **** CFLAGS_INCLUDE = -I$(INCDIR) @TCL_INCLUDES@ CFLAGS_EXTRA = @SHLIB_CFLAGS@ @TCL_EXTRA_CFLAGS@ ! DEFS = -DNO_CONST @DEFS@ CFLAGS += @CFLAGS_DEFAULT@ $(CFLAGS_WARNING) $(CFLAGS_EXTRA) $(CFLAGS_INCLUDE) @CPPFLAGS@ $(DEFS) --- 71,75 ---- CFLAGS_INCLUDE = -I$(INCDIR) @TCL_INCLUDES@ CFLAGS_EXTRA = @SHLIB_CFLAGS@ @TCL_EXTRA_CFLAGS@ ! DEFS = @DEFS@ CFLAGS += @CFLAGS_DEFAULT@ $(CFLAGS_WARNING) $(CFLAGS_EXTRA) $(CFLAGS_INCLUDE) @CPPFLAGS@ $(DEFS) Index: nsthread.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/include/nsthread.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** nsthread.h 4 Jun 2005 11:42:12 -0000 1.3 --- nsthread.h 10 Jun 2005 07:29:19 -0000 1.4 *************** *** 40,43 **** --- 40,44 ---- #include <config.h> + #include <nscheck.h> #ifdef _WIN32 |