WL#4738: streamline/simplify @@variable creation process

Affects: Server-5.5   —   Status: Complete

now to add a new system variable one needs to
1. create an instance of a appropriate sys_var_xxx class (or write a new class
if there is no one)
2. add it to a list of variables visible in SELECT @@xxx
3. add it to the list of mysqld --command-line-options
4. add it to the list for SHOW VARIABLES

steps 2,3,4 should be eliminated.

one of the possible approaches - in a constructor each variable adds itself to
the above mentioned lists.

See also WL#1160
This will build on the work done in WL#2936
All server variables are derived from the sys_var class.
sys_var constructor adds "this" to the list of variables.
On server startup it calls set_var_init() where a loop traverses the list and
registers in all structures as necessary (after WL#2936 it's
system_variable_hash only, after this WL it'll also by my_getopt array).

Other problems with the current implementation:

- the class hierarchy is incorrect, for example, there's
  sys_var_ulonglong_ptr (for GLOBAL BIGINT variables) derived from sys_var.
  And there is sys_var_thd_ulonglong (for SESSION BIGINT variables) derived
  from sys_var_thd, derived from sys_var. Their "ulonglong-ness" is not
  derived from a common parent.

- includes are broken, set_var.h exposes lots of internal (to set_var*)
  details to everyone via the infamous mysql_priv.h. These details are
  nether interesting for or used by any other code besides set_var.cc

- variable behavior is difficult to see, one needs to check the hierarchy
  in set_var.h, from the base class sys_var and all the way down (until you
  reach the turtles), and callback functions, and default parameters -
  it's spread all over two big files.

- ad hoc implementation of many variables results in illogical behavior - some
  variables don't have default values, others don't accept floating point
  values, why yet others do, but silently round them. One group of variables
  don't accept invalid values, other does, with a warning, third does and
  rounds silently. Global-only variables are allocated in the SV struct,
  taking space in every THD. And so on.

The goals of the implementation:
1. (main) the variable is declared is *one* place, see HLDs
2. fix the class hierarchy
3. The variable behavior (at least the main features) is immediately visible
   from its declaration - all in one place
4. uniform implementation, resulting in a consistent behavior of all variables
5. old quirks are to be preserved. It's desirable to fix them, but it has to
   be discussed on a case by case basis

all goals, are, of course "whenever possible, and reasonable", they aren't
absolute.

=======================
This work introduced numerous (albeit small) changes in behavior, see the
attached file.
Few examples of new variable declarations:

static Sys_var_ulong Sys_auto_increment_offset(
       &vars, "auto_increment_offset",
       "Offset added to Auto-increment columns. Used when "
       "auto-increment-increment != 1.",
       SESSION_VAR(auto_increment_offset),
       CMD_LINE(0, OPT_ARG),
       VALID_RANGE(1,65535), DEFAULT(1), BLOCK_SIZE(1),
       NO_MUTEX_GUARD, IN_BINLOG);


static Sys_var_charptr Sys_basedir(
       &vars, "basedir", "Path to installation directory. All paths are "
       "usually resolved relative to this.",
       GLOBAL_VAR(mysql_home_ptr), CMD_LINE('b', REQUIRED_ARG), DEFAULT(0),
       READONLY);

static Sys_var_charset Sys_character_set_connection(
       &vars, "character_set_connection", "The character set used for "
       "literals that do not have a character set introducer and for "
       "number-to-string conversion.",
       SESSION_VAR(collation_connection), NO_CMD_LINE, 
       DEFAULT(&default_charset_info), NO_MUTEX_GUARD, IN_BINLOG,
       ON_CHECK(not_null), ON_UPDATE(fix_charset));

static const char *optimizer_use_mrr_names[] = {"auto", "force", "disable", 0};
static Sys_var_enum Sys_optimizer_use_mrr(
       &vars, "optimizer_use_mrr",
       "Controls whether the optimizer uses the Multi-Range Read (MRR) "
       "access method",
       SESSION_VAR(optimizer_use_mrr), NO_CMD_LINE,
       optimizer_use_mrr_names, DEFAULT(1));

a variable declaration automatically creates a command-line option for
mysqld.cc (unless NO_CMD_LINE is specified), most of the behavior is visible
at once (global/session, the range of valid values, default, etc). special
behavior is implemented - where possible - via callback ON_CHECK and ON_UPDATE
functions to keep the number of classes in the hierarchy small.