1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

[svn] Use __builtin_expect to provide a hint that -d is unlikely.

This commit is contained in:
hniksic 2005-04-10 12:54:02 -07:00
parent 67859c4035
commit 62ecd29a84
2 changed files with 23 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2005-04-10 Hrvoje Niksic <hniksic@xemacs.org>
* wget.h (DEBUGP): Use __builtin_expect to give a hint to GCC that
opt.debug is false in the vast majority of cases.
2005-04-10 Hrvoje Niksic <hniksic@xemacs.org> 2005-04-10 Hrvoje Niksic <hniksic@xemacs.org>
* config-post.h: Declare alloca as void *, not char *. * config-post.h: Declare alloca as void *, not char *.

View File

@ -91,23 +91,31 @@ so, delete this exception statement from your version. */
/* locale independent replacement for ctype.h */ /* locale independent replacement for ctype.h */
#include "safe-ctype.h" #include "safe-ctype.h"
#define DO_NOTHING do {} while (0) /* Conditionalize the use of GCC's __attribute__((format)) and
__builtin_expect features using macros. */
#if defined(__GNUC__) && __GNUC__ >= 3
# define GCC_FORMAT_ATTR(a, b) __attribute__ ((format (printf, a, b)))
# define LIKELY(exp) __builtin_expect (!!(exp), 1)
# define UNLIKELY(exp) __builtin_expect ((exp), 0)
#else
# define GCC_FORMAT_ATTR(a, b)
# define LIKELY(exp) (exp)
# define UNLIKELY(exp) (exp)
#endif
/* Print X if debugging is enabled; a no-op otherwise. */ /* Print X if debugging is enabled; a no-op otherwise. */
#ifdef ENABLE_DEBUG #ifdef ENABLE_DEBUG
# define DEBUGP(x) do { if (opt.debug) { debug_logprintf x; } } while (0) # define DEBUGP(x) do if (UNLIKELY (opt.debug)) {debug_logprintf x;} while (0)
#else /* not ENABLE_DEBUG */ #else /* not ENABLE_DEBUG */
# define DEBUGP(x) DO_NOTHING # define DEBUGP(x) do {} while (0)
#endif /* not ENABLE_DEBUG */ #endif /* not ENABLE_DEBUG */
#ifdef __GNUC__ /* Define an integer type that works for file sizes, content lengths,
# define GCC_FORMAT_ATTR(a, b) __attribute__ ((format (printf, a, b))) and such. Normally we could just use off_t, but off_t is always
#else /* not __GNUC__ */ 32-bit on Windows. */
# define GCC_FORMAT_ATTR(a, b)
#endif /* not __GNUC__ */
/* Define an integer type that works for LFS. off_t would be perfect
for this, but off_t is always 32-bit under Windows. */
#ifndef WINDOWS #ifndef WINDOWS
typedef off_t wgint; typedef off_t wgint;
# define SIZEOF_WGINT SIZEOF_OFF_T # define SIZEOF_WGINT SIZEOF_OFF_T