diff options
author | Rich Salz <rsalz@akamai.com> | 2015-05-15 13:50:38 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-06-02 12:40:24 -0400 |
commit | 9c3bcfa027cb32421ed20ab77553860b922b82fc (patch) | |
tree | 5bc2b7a055c4abbc75431212948d0693d922f3ab /apps/speed.c | |
parent | 366e2a60b2fcc727b061f1459343245476ad6c3b (diff) | |
download | openssl-9c3bcfa027cb32421ed20ab77553860b922b82fc.tar.gz |
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>
Diffstat (limited to 'apps/speed.c')
-rw-r--r-- | apps/speed.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/apps/speed.c b/apps/speed.c index b93237e591..45a060fd14 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -358,19 +358,19 @@ OPTIONS speed_options[] = { {OPT_HELP_STR, 1, '-', "Usage: %s [options] ciphers...\n"}, {OPT_HELP_STR, 1, '-', "Valid options are:\n"}, {"help", OPT_HELP, '-', "Display this summary"}, + {"evp", OPT_EVP, 's', "Use specified EVP cipher"}, + {"decrypt", OPT_DECRYPT, '-', + "Time decryption instead of encryption (only EVP)"}, + {"mr", OPT_MR, '-', "Produce machine readable output"}, + {"mb", OPT_MB, '-'}, + {"misalign", OPT_MISALIGN, 'n', "Amount to mis-align buffers"}, #if defined(TIMES) || defined(USE_TOD) {"elapsed", OPT_ELAPSED, '-', "Measure time in real time instead of CPU user time"}, #endif - {"evp", OPT_EVP, 's', "Use specified EVP cipher"}, - {"decrypt", OPT_DECRYPT, '-', - "Time decryption instead of encryption (only EVP)"}, #ifndef NO_FORK {"multi", OPT_MULTI, 'p', "Run benchmarks in parallel"}, #endif - {"mr", OPT_MR, '-', "Produce machine readable output"}, - {"mb", OPT_MB, '-'}, - {"misalign", OPT_MISALIGN, 'n', "Amount to mis-align buffers"}, #ifndef OPENSSL_NO_ENGINE {"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"}, #endif @@ -829,11 +829,11 @@ int speed_main(int argc, char **argv) case OPT_ENGINE: (void)setup_engine(opt_arg(), 0); break; -#ifndef NO_FORK case OPT_MULTI: +#ifndef NO_FORK multi = atoi(opt_arg()); - break; #endif + break; case OPT_MISALIGN: if (!opt_int(opt_arg(), &misalign)) goto end; |