[MDEV-6650] LINT_INIT emits code in non-debug builds Created: 2014-08-27  Updated: 2015-03-16  Resolved: 2015-03-16

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 5.5.39, 10.0.13, 10.1.1
Fix Version/s: 10.1.4

Type: Bug Priority: Minor
Reporter: Sergey Vojtovich Assignee: Sergey Vojtovich
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-6305 UNINIT_VAR emits code in non-debug bu... Closed

 Description   

Leaving variables uninitialized in certain cases helps to achieve top-notch performance. Sometimes compiler thinks that variable may be used uninitialized (whereas it may not) and emits a warning.

To silence these warnings there is LINT_INIT() macro:

#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
    (defined(__GNUC__) && defined(__cplusplus))
#define LINT_INIT(var) var= 0
#else
#define LINT_INIT(var)
#endif

It always emits "x= 0" for C++ code compiled with gcc. In fact this is a workaround for gcc bug, which was fixed 3 years ago.



 Comments   
Comment by Sergey Vojtovich [ 2015-02-10 ]

serg, please review fix for this bug.

Generated at Thu Feb 08 07:13:34 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.