Open GoogleCodeExporter opened 9 years ago
This works, but no deprecated warning because of this bug of gcc, clang hs no
this problem.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56130
And a warning message should be printed when set the flag from command
line/flagfile.
To do this, more code should be modified, so I didn't do it.
Original comment by chen3feng
on 29 Jan 2013 at 10:25
Sorry for not replying earlier. I think this can be a useful addition. Given
that I myself end up being sometime indecisive about the actual flag name, it
could even be interesting to allow aliases without deprecation warning.
Moreover, I think these aliases should only be aliases for the command-line,
but not actual global variable references in the code. If you want to postpone
renaming the variables in the code, you can still define a reference yourself
such as
DEFINE_int32(xfs_master_port, 8000, "some bool value");
int32 &FLAGS_master_port = FLAGS_xfs_master_port;
with suitable deprecation notice and so forth. This, however, is already
project specific and I would not make it part of the gflags library API. Most
developers would at this point search & replace FLAGS_master_port by
FLAGS_xfs_master_port.
To still allow the use of --master_port as an alternative to --xfs_master_port,
there could be the possibility to add such alternative strings to the existing
flag object. For example using a macro such as:
DEFINE_alias(xfs_master_port, master_port);
This would fit better into the existing API, does not require per-type macros,
and not introduce additional C++ objects for the same flag value (references).
Moreover, the help output can consider to format these alternatives along the
actual primary command-line flag use.
Original comment by andreas....@gmail.com
on 20 Mar 2014 at 3:22
Original issue reported on code.google.com by
chen3feng
on 28 Jan 2013 at 1:22Attachments: