Skip to content

Commit 203f4d4

Browse files
committed
Add parenthesis in macro definitions to prevent order of operation problems.
When macro is expanded in an expression like ~QPLAN_QC_NO (e.g. in the Query_cache::send_result_to_client() function in sql/sql_cache.cc) then without the parenthesis the expression will be evaluated to a wrong value.
1 parent 3bbffc2 commit 203f4d4

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

sql/log_slow.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@
1616
/* Defining what to log to slow log */
1717

1818
#define LOG_SLOW_VERBOSITY_INIT 0
19-
#define LOG_SLOW_VERBOSITY_INNODB 1 << 0
20-
#define LOG_SLOW_VERBOSITY_QUERY_PLAN 1 << 1
21-
#define LOG_SLOW_VERBOSITY_EXPLAIN 1 << 2
19+
#define LOG_SLOW_VERBOSITY_INNODB (1 << 0)
20+
#define LOG_SLOW_VERBOSITY_QUERY_PLAN (1 << 1)
21+
#define LOG_SLOW_VERBOSITY_EXPLAIN (1 << 2)
2222

2323
#define QPLAN_INIT QPLAN_QC_NO
2424

25-
#define QPLAN_ADMIN 1 << 0
26-
#define QPLAN_FILESORT 1 << 1
27-
#define QPLAN_FILESORT_DISK 1 << 2
28-
#define QPLAN_FULL_JOIN 1 << 3
29-
#define QPLAN_FULL_SCAN 1 << 4
30-
#define QPLAN_QC 1 << 5
31-
#define QPLAN_QC_NO 1 << 6
32-
#define QPLAN_TMP_DISK 1 << 7
33-
#define QPLAN_TMP_TABLE 1 << 8
34-
#define QPLAN_FILESORT_PRIORITY_QUEUE 1 << 9
25+
#define QPLAN_ADMIN (1 << 0)
26+
#define QPLAN_FILESORT (1 << 1)
27+
#define QPLAN_FILESORT_DISK (1 << 2)
28+
#define QPLAN_FULL_JOIN (1 << 3)
29+
#define QPLAN_FULL_SCAN (1 << 4)
30+
#define QPLAN_QC (1 << 5)
31+
#define QPLAN_QC_NO (1 << 6)
32+
#define QPLAN_TMP_DISK (1 << 7)
33+
#define QPLAN_TMP_TABLE (1 << 8)
34+
#define QPLAN_FILESORT_PRIORITY_QUEUE (1 << 9)
3535

3636
/* ... */
37-
#define QPLAN_MAX ((ulong) 1) << 31 /* reserved as placeholder */
37+
#define QPLAN_MAX (((ulong) 1) << 31) /* reserved as placeholder */
3838

0 commit comments

Comments
 (0)