Skip to content

Commit

Permalink
Assertion on message length for the -h option
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed May 31, 2023
1 parent 3bc5f6b commit e502600
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ruby.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,16 @@ show_usage_line(const char *str, unsigned int namelen, unsigned int secondlen, i
static void
usage(const char *name, int help, int highlight, int columns)
{
/* This message really ought to be max 23 lines.
* Removed -h because the user already knows that option. Others? */

#define M(shortopt, longopt, desc) RUBY_OPT_MESSAGE(shortopt, longopt, desc)

#if USE_YJIT
# define PLATFORM_JIT_OPTION "--yjit"
#else
# define PLATFORM_JIT_OPTION "--rjit (experimental)"
#endif

/* This message really ought to be max 23 lines.
* Removed -h because the user already knows that option. Others? */
static const struct ruby_opt_message usage_msg[] = {
M("-0[octal]", "", "specify record separator (\\0, if no argument)"),
M("-a", "", "autosplit mode with -n or -p (splits $_ into $F)"),
Expand Down Expand Up @@ -293,6 +293,8 @@ usage(const char *name, int help, int highlight, int columns)
#endif
M("-h", "", "show this message, --help for more info"),
};
STATIC_ASSERT(usage_msg_size, numberof(usage_msg) < 25);

static const struct ruby_opt_message help_msg[] = {
M("--copyright", "", "print the copyright"),
M("--dump={insns|parsetree|...}[,...]", "",
Expand Down

0 comments on commit e502600

Please sign in to comment.