Standardize handling of #ifdef'd options.

Here are the "rules" for handling flags that depend on #ifdef:

- Do not ifdef the enum.  Only ifdef the OPTIONS table.  All ifdef'd
  entries appear at the end; by convention "engine" is last.  This
  ensures that at run-time, the flag will never be recognized/allowed.
  The next two bullets entries are for silencing compiler warnings:
- In the while/switch parsing statement, use #ifdef for the body to
  disable it; leave the "case OPT_xxx:" and "break" statements outside
  the ifdef/ifndef.  See ciphers.c for example.
- If there are multiple options controlled by a single guard, OPT_FOO,
  OPT_BAR, etc., put a an #ifdef around the set, and then do "#else"
  and a series of case labels and a break. See OPENSSL_NO_AES in cms.c
  for example.

Reviewed-by: Matt Caswell <matt@openssl.org>
This commit is contained in:
Rich Salz
2015-05-15 13:50:38 -04:00
committed by Rich Salz
parent 366e2a60b2
commit 9c3bcfa027
22 changed files with 222 additions and 219 deletions

View File

@@ -114,9 +114,7 @@ typedef enum OPTION_choice {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
OPT_CONNECT, OPT_CIPHER, OPT_CERT, OPT_KEY, OPT_CAPATH,
OPT_CAFILE, OPT_NEW, OPT_REUSE, OPT_BUGS, OPT_VERIFY, OPT_TIME,
#ifndef OPENSSL_NO_SSL3
OPT_SSL3,
#endif
OPT_WWW
} OPTION_CHOICE;
@@ -227,11 +225,11 @@ int s_time_main(int argc, char **argv)
goto end;
}
break;
#ifndef OPENSSL_NO_SSL3
case OPT_SSL3:
#ifndef OPENSSL_NO_SSL3
meth = SSLv3_client_method();
break;
#endif
break;
}
}
argc = opt_num_rest();