Skip to content

Commit 17ce432

Browse files
author
Martin Hansson
committed
Bug#29812381: ADD OVERRIDE SPECIFIER TO CLASSES IN THE PARSER FILES.
Patch adds 'override' specifiers and removes redundant 'virtual' dittos in all files whose names start with 'parse_'. Change-Id: Ia7043cf5d7c7e35e7dee59b9e3a2a85fc883bd61
1 parent 40ce1c6 commit 17ce432

7 files changed

+177
-177
lines changed

Diff for: sql/parse_file.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ class Unknown_key_hook {
7070
class File_parser_dummy_hook : public Unknown_key_hook {
7171
public:
7272
File_parser_dummy_hook() {} /* Remove gcc warning */
73-
virtual bool process_unknown_string(const char *&unknown_key, uchar *,
74-
MEM_ROOT *, const char *);
73+
bool process_unknown_string(const char *&unknown_key, uchar *, MEM_ROOT *,
74+
const char *) override;
7575
};
7676

7777
extern File_parser_dummy_hook file_parser_dummy_hook;

Diff for: sql/parse_tree_column_attrs.h

+47-47
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class PT_column_attr_base : public Parse_tree_node_tmpl<Column_parse_context> {
123123
*/
124124
class PT_null_column_attr : public PT_column_attr_base {
125125
public:
126-
virtual void apply_type_flags(ulong *type_flags) const {
126+
void apply_type_flags(ulong *type_flags) const override {
127127
*type_flags &= ~NOT_NULL_FLAG;
128128
*type_flags |= EXPLICIT_NULL_FLAG;
129129
}
@@ -135,7 +135,7 @@ class PT_null_column_attr : public PT_column_attr_base {
135135
@ingroup ptn_column_attrs
136136
*/
137137
class PT_not_null_column_attr : public PT_column_attr_base {
138-
virtual void apply_type_flags(ulong *type_flags) const {
138+
void apply_type_flags(ulong *type_flags) const override {
139139
*type_flags |= NOT_NULL_FLAG;
140140
}
141141
};
@@ -159,11 +159,11 @@ class PT_secondary_column_attr : public PT_column_attr_base {
159159
*/
160160
class PT_unique_key_column_attr : public PT_column_attr_base {
161161
public:
162-
virtual void apply_type_flags(ulong *type_flags) const {
162+
void apply_type_flags(ulong *type_flags) const override {
163163
*type_flags |= UNIQUE_FLAG;
164164
}
165165

166-
virtual void apply_alter_info_flags(ulonglong *flags) const {
166+
void apply_alter_info_flags(ulonglong *flags) const override {
167167
*flags |= Alter_info::ALTER_ADD_INDEX;
168168
}
169169
};
@@ -175,11 +175,11 @@ class PT_unique_key_column_attr : public PT_column_attr_base {
175175
*/
176176
class PT_primary_key_column_attr : public PT_column_attr_base {
177177
public:
178-
virtual void apply_type_flags(ulong *type_flags) const {
178+
void apply_type_flags(ulong *type_flags) const override {
179179
*type_flags |= PRI_KEY_FLAG | NOT_NULL_FLAG;
180180
}
181181

182-
virtual void apply_alter_info_flags(ulonglong *flags) const {
182+
void apply_alter_info_flags(ulonglong *flags) const override {
183183
*flags |= Alter_info::ALTER_ADD_INDEX;
184184
}
185185
};
@@ -250,7 +250,7 @@ class PT_comment_column_attr : public PT_column_attr_base {
250250
explicit PT_comment_column_attr(const LEX_CSTRING &comment)
251251
: comment(comment) {}
252252

253-
virtual void apply_comment(LEX_CSTRING *to) const { *to = comment; }
253+
void apply_comment(LEX_CSTRING *to) const override { *to = comment; }
254254
};
255255

256256
/**
@@ -294,16 +294,16 @@ class PT_default_column_attr : public PT_column_attr_base {
294294

295295
public:
296296
explicit PT_default_column_attr(Item *item) : item(item) {}
297-
virtual void apply_default_value(Item **value) const { *value = item; }
297+
void apply_default_value(Item **value) const override { *value = item; }
298298

299-
virtual bool contextualize(Column_parse_context *pc) {
299+
bool contextualize(Column_parse_context *pc) override {
300300
if (pc->is_generated) {
301301
my_error(ER_WRONG_USAGE, MYF(0), "DEFAULT", "generated column");
302302
return true;
303303
}
304304
return super::contextualize(pc) || item->itemize(pc, &item);
305305
}
306-
virtual void apply_type_flags(ulong *type_flags) const {
306+
void apply_type_flags(ulong *type_flags) const override {
307307
if (item->type() == Item::NULL_ITEM) *type_flags |= EXPLICIT_NULL_FLAG;
308308
}
309309
};
@@ -321,9 +321,9 @@ class PT_on_update_column_attr : public PT_column_attr_base {
321321

322322
public:
323323
explicit PT_on_update_column_attr(uint8 precision) : precision(precision) {}
324-
virtual void apply_on_update_value(Item **value) const { *value = item; }
324+
void apply_on_update_value(Item **value) const override { *value = item; }
325325

326-
virtual bool contextualize(Column_parse_context *pc) {
326+
bool contextualize(Column_parse_context *pc) override {
327327
if (pc->is_generated) {
328328
my_error(ER_WRONG_USAGE, MYF(0), "ON UPDATE", "generated column");
329329
return true;
@@ -344,10 +344,10 @@ class PT_auto_increment_column_attr : public PT_column_attr_base {
344344
typedef PT_column_attr_base super;
345345

346346
public:
347-
virtual void apply_type_flags(ulong *type_flags) const {
347+
void apply_type_flags(ulong *type_flags) const override {
348348
*type_flags |= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG;
349349
}
350-
virtual bool contextualize(Column_parse_context *pc) {
350+
bool contextualize(Column_parse_context *pc) override {
351351
if (pc->is_generated) {
352352
my_error(ER_WRONG_USAGE, MYF(0), "AUTO_INCREMENT", "generated column");
353353
return true;
@@ -365,13 +365,13 @@ class PT_serial_default_value_column_attr : public PT_column_attr_base {
365365
typedef PT_column_attr_base super;
366366

367367
public:
368-
virtual void apply_type_flags(ulong *type_flags) const {
368+
void apply_type_flags(ulong *type_flags) const override {
369369
*type_flags |= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNIQUE_FLAG;
370370
}
371-
virtual void apply_alter_info_flags(ulonglong *flags) const {
371+
void apply_alter_info_flags(ulonglong *flags) const override {
372372
*flags |= Alter_info::ALTER_ADD_INDEX;
373373
}
374-
virtual bool contextualize(Column_parse_context *pc) {
374+
bool contextualize(Column_parse_context *pc) override {
375375
if (pc->is_generated) {
376376
my_error(ER_WRONG_USAGE, MYF(0), "SERIAL DEFAULT VALUE",
377377
"generated column");
@@ -395,11 +395,11 @@ class PT_column_format_column_attr : public PT_column_attr_base {
395395
explicit PT_column_format_column_attr(column_format_type format)
396396
: format(format) {}
397397

398-
virtual void apply_type_flags(ulong *type_flags) const {
398+
void apply_type_flags(ulong *type_flags) const override {
399399
*type_flags &= ~(FIELD_FLAGS_COLUMN_FORMAT_MASK);
400400
*type_flags |= format << FIELD_FLAGS_COLUMN_FORMAT;
401401
}
402-
virtual bool contextualize(Column_parse_context *pc) {
402+
bool contextualize(Column_parse_context *pc) override {
403403
if (pc->is_generated) {
404404
my_error(ER_WRONG_USAGE, MYF(0), "COLUMN_FORMAT", "generated column");
405405
return true;
@@ -422,11 +422,11 @@ class PT_storage_media_column_attr : public PT_column_attr_base {
422422
explicit PT_storage_media_column_attr(ha_storage_media media)
423423
: media(media) {}
424424

425-
virtual void apply_type_flags(ulong *type_flags) const {
425+
void apply_type_flags(ulong *type_flags) const override {
426426
*type_flags &= ~(FIELD_FLAGS_STORAGE_MEDIA_MASK);
427427
*type_flags |= media << FIELD_FLAGS_STORAGE_MEDIA;
428428
}
429-
virtual bool contextualize(Column_parse_context *pc) {
429+
bool contextualize(Column_parse_context *pc) override {
430430
if (pc->is_generated) {
431431
my_error(ER_WRONG_USAGE, MYF(0), "STORAGE", "generated column");
432432
return true;
@@ -556,11 +556,11 @@ class PT_numeric_type : public PT_type {
556556
}
557557
}
558558

559-
virtual ulong get_type_flags() const {
559+
ulong get_type_flags() const override {
560560
return (options & ZEROFILL_FLAG) ? (options | UNSIGNED_FLAG) : options;
561561
}
562-
virtual const char *get_length() const { return length; }
563-
virtual const char *get_dec() const { return dec; }
562+
const char *get_length() const override { return length; }
563+
const char *get_dec() const override { return dec; }
564564
};
565565

566566
/**
@@ -576,7 +576,7 @@ class PT_bit_type : public PT_type {
576576
explicit PT_bit_type(const char *length)
577577
: PT_type(MYSQL_TYPE_BIT), length(length) {}
578578

579-
virtual const char *get_length() const { return length; }
579+
const char *get_length() const override { return length; }
580580
};
581581

582582
/**
@@ -587,7 +587,7 @@ class PT_bit_type : public PT_type {
587587
class PT_boolean_type : public PT_type {
588588
public:
589589
PT_boolean_type() : PT_type(MYSQL_TYPE_TINY) {}
590-
virtual const char *get_length() const { return "1"; }
590+
const char *get_length() const override { return "1"; }
591591
};
592592

593593
enum class Char_type : ulong {
@@ -615,11 +615,11 @@ class PT_char_type : public PT_type {
615615
PT_char_type(Char_type char_type, const CHARSET_INFO *charset,
616616
bool force_binary = false)
617617
: PT_char_type(char_type, "1", charset, force_binary) {}
618-
virtual ulong get_type_flags() const {
618+
ulong get_type_flags() const override {
619619
return force_binary ? BINCMP_FLAG : 0;
620620
}
621-
virtual const char *get_length() const { return length; }
622-
virtual const CHARSET_INFO *get_charset() const { return charset; }
621+
const char *get_length() const override { return length; }
622+
const CHARSET_INFO *get_charset() const override { return charset; }
623623
};
624624

625625
enum class Blob_type {
@@ -658,11 +658,11 @@ class PT_blob_type : public PT_type {
658658
charset(&my_charset_bin),
659659
force_binary(false) {}
660660

661-
virtual ulong get_type_flags() const {
661+
ulong get_type_flags() const override {
662662
return force_binary ? BINCMP_FLAG : 0;
663663
}
664-
virtual const CHARSET_INFO *get_charset() const { return charset; }
665-
virtual const char *get_length() const { return length; }
664+
const CHARSET_INFO *get_charset() const override { return charset; }
665+
const char *get_length() const override { return length; }
666666
};
667667

668668
/**
@@ -704,7 +704,7 @@ class PT_time_type : public PT_type {
704704
PT_time_type(Time_type time_type, const char *dec)
705705
: PT_type(static_cast<Parent_type>(time_type)), dec(dec) {}
706706

707-
virtual const char *get_dec() const { return dec; }
707+
const char *get_dec() const override { return dec; }
708708
};
709709

710710
/**
@@ -722,10 +722,10 @@ class PT_timestamp_type : public PT_type {
722722
explicit PT_timestamp_type(const char *dec)
723723
: super(MYSQL_TYPE_TIMESTAMP2), dec(dec), type_flags(0) {}
724724

725-
virtual const char *get_dec() const { return dec; }
726-
virtual ulong get_type_flags() const { return type_flags; }
725+
const char *get_dec() const override { return dec; }
726+
ulong get_type_flags() const override { return type_flags; }
727727

728-
virtual bool contextualize(Parse_context *pc) {
728+
bool contextualize(Parse_context *pc) override {
729729
if (super::contextualize(pc)) return true;
730730
/*
731731
TIMESTAMP fields are NOT NULL by default, unless the variable
@@ -760,9 +760,9 @@ class PT_spacial_type : public PT_type {
760760
explicit PT_spacial_type(Field::geometry_type geo_type)
761761
: PT_type(MYSQL_TYPE_GEOMETRY), geo_type(geo_type) {}
762762

763-
virtual const CHARSET_INFO *get_charset() const { return &my_charset_bin; }
764-
virtual uint get_uint_geom_type() const { return geo_type; }
765-
virtual const char *get_length() const { return NULL; }
763+
const CHARSET_INFO *get_charset() const override { return &my_charset_bin; }
764+
uint get_uint_geom_type() const override { return geo_type; }
765+
const char *get_length() const override { return NULL; }
766766
};
767767

768768
enum class Enum_type { ENUM = MYSQL_TYPE_ENUM, SET = MYSQL_TYPE_SET };
@@ -785,11 +785,11 @@ class PT_enum_type_tmpl : public PT_type {
785785
DBUG_ASSERT(charset == NULL || !force_binary);
786786
}
787787

788-
virtual const CHARSET_INFO *get_charset() const { return charset; }
789-
virtual ulong get_type_flags() const {
788+
const CHARSET_INFO *get_charset() const override { return charset; }
789+
ulong get_type_flags() const override {
790790
return force_binary ? BINCMP_FLAG : 0;
791791
}
792-
virtual List<String> *get_interval_list() const { return interval_list; }
792+
List<String> *get_interval_list() const override { return interval_list; }
793793
};
794794

795795
/**
@@ -810,7 +810,7 @@ class PT_serial_type : public PT_type {
810810
public:
811811
PT_serial_type() : PT_type(MYSQL_TYPE_LONGLONG) {}
812812

813-
virtual ulong get_type_flags() const {
813+
ulong get_type_flags() const override {
814814
return AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNSIGNED_FLAG | UNIQUE_FLAG;
815815
}
816816
};
@@ -823,7 +823,7 @@ class PT_serial_type : public PT_type {
823823
class PT_json_type : public PT_type {
824824
public:
825825
PT_json_type() : PT_type(MYSQL_TYPE_JSON) {}
826-
virtual const CHARSET_INFO *get_charset() const { return &my_charset_bin; }
826+
const CHARSET_INFO *get_charset() const override { return &my_charset_bin; }
827827
};
828828

829829
/**
@@ -869,7 +869,7 @@ class PT_field_def_base : public Parse_tree_node {
869869
type_node(type_node) {}
870870

871871
public:
872-
virtual bool contextualize(Parse_context *pc) {
872+
bool contextualize(Parse_context *pc) override {
873873
if (super::contextualize(pc) || type_node->contextualize(pc)) return true;
874874

875875
type = type_node->type;
@@ -923,7 +923,7 @@ class PT_field_def : public PT_field_def_base {
923923
Mem_root_array<PT_column_attr_base *> *opt_attrs)
924924
: super(type_node_arg), opt_attrs(opt_attrs) {}
925925

926-
virtual bool contextualize(Parse_context *pc_arg) {
926+
bool contextualize(Parse_context *pc_arg) override {
927927
Column_parse_context pc(pc_arg->thd, pc_arg->select, false);
928928
return super::contextualize(&pc) || contextualize_attrs(&pc, opt_attrs);
929929
}
@@ -950,7 +950,7 @@ class PT_generated_field_def : public PT_field_def_base {
950950
expr(expr),
951951
opt_attrs(opt_attrs) {}
952952

953-
virtual bool contextualize(Parse_context *pc_arg) {
953+
bool contextualize(Parse_context *pc_arg) override {
954954
Column_parse_context pc(pc_arg->thd, pc_arg->select, true);
955955
if (super::contextualize(&pc) || contextualize_attrs(&pc, opt_attrs) ||
956956
expr->itemize(&pc, &expr))

Diff for: sql/parse_tree_helpers.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -62,28 +62,28 @@ class Parse_tree_item : public Item {
6262
public:
6363
explicit Parse_tree_item(const POS &pos) : Item(pos) {}
6464

65-
virtual enum Type type() const { return INVALID_ITEM; }
66-
virtual double val_real() {
65+
enum Type type() const override { return INVALID_ITEM; }
66+
double val_real() override {
6767
DBUG_ASSERT(0);
6868
return 0;
6969
}
70-
virtual longlong val_int() {
70+
longlong val_int() override {
7171
DBUG_ASSERT(0);
7272
return 0;
7373
}
74-
virtual String *val_str(String *) {
74+
String *val_str(String *) override {
7575
DBUG_ASSERT(0);
7676
return NULL;
7777
}
78-
virtual my_decimal *val_decimal(my_decimal *) {
78+
my_decimal *val_decimal(my_decimal *) override {
7979
DBUG_ASSERT(0);
8080
return NULL;
8181
}
82-
virtual bool get_date(MYSQL_TIME *, uint) {
82+
bool get_date(MYSQL_TIME *, uint) override {
8383
DBUG_ASSERT(0);
8484
return false;
8585
}
86-
virtual bool get_time(MYSQL_TIME *) {
86+
bool get_time(MYSQL_TIME *) override {
8787
DBUG_ASSERT(0);
8888
return false;
8989
}
@@ -99,7 +99,7 @@ class PT_item_list : public Parse_tree_node {
9999
public:
100100
List<Item> value;
101101

102-
virtual bool contextualize(Parse_context *pc) {
102+
bool contextualize(Parse_context *pc) override {
103103
if (super::contextualize(pc)) return true;
104104
List_iterator<Item> it(value);
105105
Item *item;

0 commit comments

Comments
 (0)