~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/item.cc

Bunch of warning cleanups.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
 
45
45
 
46
46
my_decimal *
47
 
Hybrid_type_traits::val_decimal(Hybrid_type *val, my_decimal *to) const
 
47
Hybrid_type_traits::val_decimal(Hybrid_type *val,
 
48
                                my_decimal *to __attribute__((__unused__))) const
48
49
{
49
50
  double2my_decimal(E_DEC_FATAL_ERROR, val->real, val->dec_buf);
50
51
  return val->dec_buf;
147
148
}
148
149
 
149
150
void
150
 
Hybrid_type_traits_integer::fix_length_and_dec(Item *item, Item *arg) const
 
151
Hybrid_type_traits_integer::fix_length_and_dec(Item *item,
 
152
                                               Item *arg __attribute__((__unused__))) const
151
153
{
152
154
  item->decimals= 0;
153
155
  item->max_length= MY_INT64_NUM_DECIMAL_DIGITS;
470
472
  @param arg   a dummy parameter, is not used here
471
473
*/
472
474
 
473
 
bool Item::cleanup_processor(uchar *arg)
 
475
bool Item::cleanup_processor(uchar *arg __attribute__((__unused__)))
474
476
{
475
477
  if (fixed)
476
478
    cleanup();
738
740
  - When trying to find an ORDER BY/GROUP BY item in the SELECT part
739
741
*/
740
742
 
741
 
bool Item::eq(const Item *item, bool binary_cmp) const
 
743
bool Item::eq(const Item *item, bool binary_cmp __attribute__((__unused__))) const
742
744
{
743
745
  /*
744
746
    Note, that this is never true if item is a Item_param:
768
770
  the latter returns a non-fixed Item, so val_str() crashes afterwards.
769
771
  Override Item_num method, to return a fixed item.
770
772
*/
771
 
Item *Item_num::safe_charset_converter(CHARSET_INFO *tocs)
 
773
Item *Item_num::safe_charset_converter(CHARSET_INFO *tocs __attribute__((__unused__)))
772
774
{
773
775
  Item_string *conv;
774
776
  char buf[64];
783
785
}
784
786
 
785
787
 
786
 
Item *Item_static_float_func::safe_charset_converter(CHARSET_INFO *tocs)
 
788
Item *Item_static_float_func::safe_charset_converter(CHARSET_INFO *tocs __attribute__((__unused__)))
787
789
{
788
790
  Item_string *conv;
789
791
  char buf[64];
1431
1433
  Item_field (this is important in prepared statements).
1432
1434
*/
1433
1435
 
1434
 
Item_field::Item_field(THD *thd, Name_resolution_context *context_arg,
 
1436
Item_field::Item_field(THD *thd __attribute__((__unused__)),
 
1437
                       Name_resolution_context *context_arg,
1435
1438
                       Field *f)
1436
1439
  :Item_ident(context_arg, f->table->s->db.str, *f->table_name, f->field_name),
1437
1440
   item_equal(0), no_const_subst(0),
1526
1529
  return tmp;
1527
1530
}
1528
1531
 
1529
 
void Item_ident::print(String *str, enum_query_type query_type)
 
1532
void Item_ident::print(String *str,
 
1533
                       enum_query_type query_type __attribute__((__unused__)))
1530
1534
{
1531
1535
  THD *thd= current_thd;
1532
1536
  char d_name_buff[MAX_ALIAS_NAME], t_name_buff[MAX_ALIAS_NAME];
1703
1707
}
1704
1708
 
1705
1709
 
1706
 
bool Item_field::eq(const Item *item, bool binary_cmp) const
 
1710
bool Item_field::eq(const Item *item,
 
1711
                    bool binary_cmp __attribute__((__unused__))) const
1707
1712
{
1708
1713
  Item *real_item= ((Item *) item)->real_item();
1709
1714
  if (real_item->type() != FIELD_ITEM)
1710
1715
    return 0;
1711
 
  
 
1716
 
1712
1717
  Item_field *item_field= (Item_field*) real_item;
1713
1718
  if (item_field->field && field)
1714
1719
    return item_field->field == field;
1741
1746
}
1742
1747
 
1743
1748
 
1744
 
void Item_field::fix_after_pullout(st_select_lex *new_parent, Item **ref)
 
1749
void Item_field::fix_after_pullout(st_select_lex *new_parent,
 
1750
                                   Item **ref __attribute__((__unused__)))
1745
1751
{
1746
1752
  if (new_parent == depended_from)
1747
1753
    depended_from= NULL;
1762
1768
  return new_item;
1763
1769
}
1764
1770
 
1765
 
longlong Item_field::val_int_endpoint(bool left_endp, bool *incl_endp)
 
1771
longlong Item_field::val_int_endpoint(bool left_endp __attribute__((__unused__)),
 
1772
                                      bool *incl_endp __attribute__((__unused__)))
1766
1773
{
1767
1774
  longlong res= val_int();
1768
1775
  return null_value? LONGLONG_MIN : res;
1799
1806
  return str;
1800
1807
}
1801
1808
 
1802
 
void Item_int::print(String *str, enum_query_type query_type)
 
1809
void Item_int::print(String *str,
 
1810
                     enum_query_type query_type __attribute__((__unused__)))
1803
1811
{
1804
1812
  // my_charset_bin is good enough for numbers
1805
1813
  str_value.set(value, &my_charset_bin);
1830
1838
}
1831
1839
 
1832
1840
 
1833
 
void Item_uint::print(String *str, enum_query_type query_type)
 
1841
void Item_uint::print(String *str,
 
1842
                      enum_query_type query_type __attribute__((__unused__)))
1834
1843
{
1835
1844
  // latin1 is good enough for numbers
1836
1845
  str_value.set((ulonglong) value, default_charset());
1859
1868
}
1860
1869
 
1861
1870
 
1862
 
Item_decimal::Item_decimal(double val, int precision, int scale)
 
1871
Item_decimal::Item_decimal(double val,
 
1872
                           int precision __attribute__((__unused__)),
 
1873
                           int scale __attribute__((__unused__)))
1863
1874
{
1864
1875
  double2my_decimal(E_DEC_FATAL_ERROR, val, &decimal_value);
1865
1876
  decimals= (uint8) decimal_value.frac;
1922
1933
  return result;
1923
1934
}
1924
1935
 
1925
 
void Item_decimal::print(String *str, enum_query_type query_type)
 
1936
void Item_decimal::print(String *str,
 
1937
                         enum_query_type query_type __attribute__((__unused__)))
1926
1938
{
1927
1939
  my_decimal2string(E_DEC_FATAL_ERROR, &decimal_value, 0, 0, 0, &str_value);
1928
1940
  str->append(str_value);
1929
1941
}
1930
1942
 
1931
1943
 
1932
 
bool Item_decimal::eq(const Item *item, bool binary_cmp) const
 
1944
bool Item_decimal::eq(const Item *item,
 
1945
                      bool binary_cmp __attribute__((__unused__))) const
1933
1946
{
1934
1947
  if (type() == item->type() && item->basic_const_item())
1935
1948
  {
2074
2087
}
2075
2088
 
2076
2089
 
2077
 
bool Item_null::eq(const Item *item, bool binary_cmp) const
 
2090
bool Item_null::eq(const Item *item,
 
2091
                   bool binary_cmp __attribute__((__unused__))) const
2078
2092
{ return item->type() == type(); }
2079
2093
 
2080
2094
 
2093
2107
  return 0;
2094
2108
}
2095
2109
/* ARGSUSED */
2096
 
String *Item_null::val_str(String *str)
 
2110
String *Item_null::val_str(String *str __attribute__((__unused__)))
2097
2111
{
2098
2112
  // following assert is redundant, because fixed=1 assigned in constructor
2099
2113
  DBUG_ASSERT(fixed == 1);
2101
2115
  return 0;
2102
2116
}
2103
2117
 
2104
 
my_decimal *Item_null::val_decimal(my_decimal *decimal_value)
 
2118
my_decimal *Item_null::val_decimal(my_decimal *decimal_value __attribute__((__unused__)))
2105
2119
{
2106
2120
  return 0;
2107
2121
}
2779
2793
 
2780
2794
/* End of Item_param related */
2781
2795
 
2782
 
void Item_param::print(String *str, enum_query_type query_type)
 
2796
void Item_param::print(String *str,
 
2797
                       enum_query_type query_type __attribute__((__unused__)))
2783
2798
{
2784
2799
  if (state == NO_VALUE)
2785
2800
  {
2809
2824
}
2810
2825
 
2811
2826
/* ARGSUSED */
2812
 
String *Item_copy_string::val_str(String *str)
 
2827
String *Item_copy_string::val_str(String *str __attribute__((__unused__)))
2813
2828
{
2814
2829
  // Item_copy_string is used without fix_fields call
2815
2830
  if (null_value)
2833
2848
*/
2834
2849
 
2835
2850
/* ARGSUSED */
2836
 
bool Item::fix_fields(THD *thd, Item **ref)
 
2851
bool Item::fix_fields(THD *thd __attribute__((__unused__)),
 
2852
                      Item **ref __attribute__((__unused__)))
2837
2853
{
2838
2854
 
2839
2855
  // We do not check fields which are fixed during construction
3875
3891
  See comments in Arg_comparator::set_compare_func() for details.
3876
3892
*/
3877
3893
 
3878
 
bool Item_field::set_no_const_sub(uchar *arg)
 
3894
bool Item_field::set_no_const_sub(uchar *arg __attribute__((__unused__)))
3879
3895
{
3880
3896
  if (field->charset() != &my_charset_bin)
3881
3897
    no_const_subst=1;
3908
3924
    - this - otherwise.
3909
3925
*/
3910
3926
 
3911
 
Item *Item_field::replace_equal_field(uchar *arg)
 
3927
Item *Item_field::replace_equal_field(uchar *arg __attribute__((__unused__)))
3912
3928
{
3913
3929
  if (item_equal)
3914
3930
  {
4370
4386
}
4371
4387
 
4372
4388
 
4373
 
int Item_string::save_in_field(Field *field, bool no_conversions)
 
4389
int Item_string::save_in_field(Field *field,
 
4390
                               bool no_conversions __attribute__((__unused__)))
4374
4391
{
4375
4392
  String *result;
4376
4393
  result=val_str(&str_value);
4385
4402
}
4386
4403
 
4387
4404
 
4388
 
int Item_int::save_in_field(Field *field, bool no_conversions)
 
4405
int Item_int::save_in_field(Field *field,
 
4406
                            bool no_conversions __attribute__((__unused__)))
4389
4407
{
4390
4408
  longlong nr=val_int();
4391
4409
  if (null_value)
4395
4413
}
4396
4414
 
4397
4415
 
4398
 
int Item_decimal::save_in_field(Field *field, bool no_conversions)
 
4416
int Item_decimal::save_in_field(Field *field,
 
4417
                                bool no_conversions __attribute__((__unused__)))
4399
4418
{
4400
4419
  field->set_notnull();
4401
4420
  return field->store_decimal(&decimal_value);
4402
4421
}
4403
4422
 
4404
4423
 
4405
 
bool Item_int::eq(const Item *arg, bool binary_cmp) const
 
4424
bool Item_int::eq(const Item *arg,
 
4425
                  bool binary_cmp __attribute__((__unused__))) const
4406
4426
{
4407
4427
  /* No need to check for null value as basic constant can't be NULL */
4408
4428
  if (arg->basic_const_item() && arg->type() == type())
4488
4508
}
4489
4509
 
4490
4510
 
4491
 
int Item_float::save_in_field(Field *field, bool no_conversions)
 
4511
int Item_float::save_in_field(Field *field,
 
4512
                              bool no_conversions __attribute__((__unused__)))
4492
4513
{
4493
4514
  double nr= val_real();
4494
4515
  if (null_value)
4498
4519
}
4499
4520
 
4500
4521
 
4501
 
void Item_float::print(String *str, enum_query_type query_type)
 
4522
void Item_float::print(String *str,
 
4523
                       enum_query_type query_type __attribute__((__unused__)))
4502
4524
{
4503
4525
  if (presentation)
4504
4526
  {
4518
4540
  In number context this is a longlong value.
4519
4541
*/
4520
4542
 
4521
 
bool Item_float::eq(const Item *arg, bool binary_cmp) const
 
4543
bool Item_float::eq(const Item *arg,
 
4544
                    bool binary_cmp __attribute__((__unused__))) const
4522
4545
{
4523
4546
  if (arg->basic_const_item() && arg->type() == type())
4524
4547
  {
4586
4609
}
4587
4610
 
4588
4611
 
4589
 
int Item_hex_string::save_in_field(Field *field, bool no_conversions)
 
4612
int Item_hex_string::save_in_field(Field *field,
 
4613
                                   bool no_conversions __attribute__((__unused__)))
4590
4614
{
4591
4615
  field->set_notnull();
4592
4616
  if (field->result_type() == STRING_RESULT)
4616
4640
}
4617
4641
 
4618
4642
 
4619
 
void Item_hex_string::print(String *str, enum_query_type query_type)
 
4643
void Item_hex_string::print(String *str,
 
4644
                            enum_query_type query_type __attribute__((__unused__)))
4620
4645
{
4621
4646
  char *end= (char*) str_value.ptr() + str_value.length(),
4622
4647
       *ptr= end - min(str_value.length(), sizeof(longlong));
4695
4720
  Pack data in buffer for sending.
4696
4721
*/
4697
4722
 
4698
 
bool Item_null::send(Protocol *protocol, String *packet)
 
4723
bool Item_null::send(Protocol *protocol,
 
4724
                     String *packet __attribute__((__unused__)))
4699
4725
{
4700
4726
  return protocol->store_null();
4701
4727
}
4806
4832
}
4807
4833
 
4808
4834
 
4809
 
bool Item_field::send(Protocol *protocol, String *buffer)
 
4835
bool Item_field::send(Protocol *protocol,
 
4836
                      String *buffer __attribute__((__unused__)))
4810
4837
{
4811
4838
  return protocol->store(result_field);
4812
4839
}
4813
4840
 
4814
4841
 
4815
 
void Item_field::update_null_value() 
4816
 
4817
 
  /* 
4818
 
    need to set no_errors to prevent warnings about type conversion 
 
4842
void Item_field::update_null_value()
 
4843
{
 
4844
  /*
 
4845
    need to set no_errors to prevent warnings about type conversion
4819
4846
    popping up.
4820
4847
  */
4821
4848
  THD *thd= field->table->in_use;
5554
5581
  }
5555
5582
}
5556
5583
 
5557
 
void Item_ref::fix_after_pullout(st_select_lex *new_parent, Item **refptr)
 
5584
void Item_ref::fix_after_pullout(st_select_lex *new_parent,
 
5585
                                 Item **refptr __attribute__((__unused__)))
5558
5586
{
5559
5587
  if (depended_from == new_parent)
5560
5588
  {
5580
5608
    false   otherwise
5581
5609
*/
5582
5610
 
5583
 
bool Item_direct_view_ref::eq(const Item *item, bool binary_cmp) const
 
5611
bool Item_direct_view_ref::eq(const Item *item,
 
5612
                              bool binary_cmp __attribute__((__unused__))) const
5584
5613
{
5585
5614
  if (item->type() == REF_ITEM)
5586
5615
  {
5596
5625
 
5597
5626
bool Item_default_value::eq(const Item *item, bool binary_cmp) const
5598
5627
{
5599
 
  return item->type() == DEFAULT_VALUE_ITEM && 
 
5628
  return item->type() == DEFAULT_VALUE_ITEM &&
5600
5629
    ((Item_default_value *)item)->arg->eq(arg, binary_cmp);
5601
5630
}
5602
5631
 
5603
5632
 
5604
 
bool Item_default_value::fix_fields(THD *thd, Item **items)
 
5633
bool Item_default_value::fix_fields(THD *thd,
 
5634
                                    Item **items __attribute__((__unused__)))
5605
5635
{
5606
5636
  Item *real_arg;
5607
5637
  Item_field *field_arg;
5717
5747
}
5718
5748
 
5719
5749
 
5720
 
bool Item_insert_value::fix_fields(THD *thd, Item **items)
 
5750
bool Item_insert_value::fix_fields(THD *thd,
 
5751
                                   Item **items __attribute__((__unused__)))
5721
5752
{
5722
5753
  DBUG_ASSERT(fixed == 0);
5723
5754
  /* We should only check that arg is in first table */
6060
6091
  return str;
6061
6092
}
6062
6093
 
6063
 
my_decimal *Item_cache_decimal::val_decimal(my_decimal *val)
 
6094
my_decimal *Item_cache_decimal::val_decimal(my_decimal *val __attribute__((__unused__)))
6064
6095
{
6065
6096
  DBUG_ASSERT(fixed);
6066
6097
  return &decimal_value;
6168
6199
}
6169
6200
 
6170
6201
 
6171
 
void Item_cache_row::illegal_method_call(const char *method)
 
6202
void Item_cache_row::illegal_method_call(const char *method __attribute__((__unused__)))
6172
6203
{
6173
6204
  DBUG_ENTER("Item_cache_row::illegal_method_call");
6174
6205
  DBUG_PRINT("error", ("!!! %s method was called for row item", method));
6325
6356
    false  OK
6326
6357
*/
6327
6358
 
6328
 
bool Item_type_holder::join_types(THD *thd, Item *item)
 
6359
bool Item_type_holder::join_types(THD *thd __attribute__((__unused__)),
 
6360
                                  Item *item)
6329
6361
{
6330
6362
  uint max_length_orig= max_length;
6331
6363
  uint decimals_orig= decimals;
6595
6627
    do nothing
6596
6628
*/
6597
6629
 
6598
 
void dummy_error_processor(THD *thd, void *data)
 
6630
void dummy_error_processor(THD *thd __attribute__((__unused__)),
 
6631
                           void *data __attribute__((__unused__)))
6599
6632
{}
6600
6633
 
6601
6634
/**