diff options
author | Marc Alff <marc.alff@sun.com> | 2009-09-17 03:20:11 -0600 |
---|---|---|
committer | Marc Alff <marc.alff@sun.com> | 2009-09-17 03:20:11 -0600 |
commit | 071634bb3578a3949e09197f7eb17c5619d01562 (patch) | |
tree | d0d731222454addb05b3890fb2bc555da5af7d63 /include | |
parent | ea0d4516ed796179ef97a791bb04a646ac98610b (diff) | |
parent | c65bfe456456db2aa60e2275b9ca428c76bbede4 (diff) | |
download | mariadb-git-071634bb3578a3949e09197f7eb17c5619d01562.tar.gz |
Merge mysql-next-mr --> mysql-trunk-signal
Diffstat (limited to 'include')
-rw-r--r-- | include/my_dbug.h | 52 | ||||
-rw-r--r-- | include/my_global.h | 19 | ||||
-rw-r--r-- | include/my_sys.h | 1 |
3 files changed, 68 insertions, 4 deletions
diff --git a/include/my_dbug.h b/include/my_dbug.h index a77e439b5db..474a46f29dd 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -16,6 +16,29 @@ #ifndef _dbug_h #define _dbug_h +#if defined(__cplusplus) && !defined(DBUG_OFF) +class Dbug_violation_helper +{ +public: + inline Dbug_violation_helper() : + _entered(TRUE) + { } + + inline ~Dbug_violation_helper() + { + assert(!_entered); + } + + inline void leave() + { + _entered= FALSE; + } + +private: + bool _entered; +}; +#endif /* C++ */ + #ifdef __cplusplus extern "C" { #endif @@ -47,11 +70,31 @@ extern void _db_lock_file_(void); extern void _db_unlock_file_(void); extern FILE *_db_fp_(void); -#define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; \ - char **_db_framep_; \ - _db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_, \ - &_db_framep_) +#ifdef __cplusplus + +#define DBUG_ENTER(a) \ + const char *_db_func_, *_db_file_; \ + uint _db_level_; \ + char **_db_framep_; \ + Dbug_violation_helper dbug_violation_helper; \ + _db_enter_ (a, __FILE__, __LINE__, &_db_func_, &_db_file_, \ + &_db_level_, &_db_framep_) +#define DBUG_VIOLATION_HELPER_LEAVE dbug_violation_helper.leave() + +#else /* C */ + +#define DBUG_ENTER(a) \ + const char *_db_func_, *_db_file_; \ + uint _db_level_; \ + char **_db_framep_; \ + _db_enter_ (a, __FILE__, __LINE__, &_db_func_, &_db_file_, \ + &_db_level_, &_db_framep_) +#define DBUG_VIOLATION_HELPER_LEAVE do { } while(0) + +#endif /* C++ */ + #define DBUG_LEAVE \ + DBUG_VIOLATION_HELPER_LEAVE; \ _db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_) #define DBUG_RETURN(a1) do {DBUG_LEAVE; return(a1);} while(0) #define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0) @@ -85,6 +128,7 @@ extern FILE *_db_fp_(void); #define DBUG_ENTER(a1) #define DBUG_LEAVE +#define DBUG_VIOLATION_HELPER_LEAVE #define DBUG_RETURN(a1) do { return(a1); } while(0) #define DBUG_VOID_RETURN do { return; } while(0) #define DBUG_EXECUTE(keyword,a1) do { } while(0) diff --git a/include/my_global.h b/include/my_global.h index 4ad851e9e5d..e7d0026ac53 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -564,6 +564,25 @@ int __void__; #define PURIFY_OR_LINT_INIT(var) #endif +/* + Suppress uninitialized variable warning without generating code. + + The _cplusplus is a temporary workaround for C++ code pending a fix + for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772). +*/ +#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(__cplusplus) || \ + !defined(__GNUC__) +#define UNINIT_VAR(x) x= 0 +#else +#define UNINIT_VAR(x) x= x +#endif + +/* Define some useful general macros */ +#if !defined(max) +#define max(a, b) ((a) > (b) ? (a) : (b)) +#define min(a, b) ((a) < (b) ? (a) : (b)) +#endif + #if !defined(HAVE_UINT) #undef HAVE_UINT #define HAVE_UINT diff --git a/include/my_sys.h b/include/my_sys.h index 473633ce6ef..038ef446096 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -78,6 +78,7 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */ #define MY_DONT_OVERWRITE_FILE 1024 /* my_copy: Don't overwrite file */ #define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */ +#define MY_SYNC 4096 /* my_copy(): sync dst file */ #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ #define MY_GIVE_INFO 2 /* Give time info about process*/ |