binutils-gdb/gdb/cli
Pedro Alves f23981e991 Eliminate UNSUPPORTED_ERROR.
I have a case that could use an exception for "unsupported feature".
I found UNSUPPORTED_ERROR, but looking deeper, I think as is, reusing
it for other things would be fragile.  E.g., if the Python script
sourced by source_script_from_stream triggers any other missing
functionality that would result in UNSUPPORTED_ERROR being propagated
out to source_script_from_stream, that would confuse the error for
Python not being built into GDB.

This patch thus redoes things a little.  Instead of using an exception
for the "No Python" scenario, check whether Python is configured in
before actually trying to source the file.  It adds a new function
instead of using #ifdef HAVE_PYTHON directly, as that is better at
avoiding bitrot, as both Python and !Python paths are visible to the
compiler this way.

Tested on Fedora 17, with and without Python.

gdb/
2013-12-12  Pedro Alves  <palves@redhat.com>

	* cli/cli-cmds.c (source_script_from_stream) Use have_python
	instead of catching UNSUPPORTED_ERROR.
	* exceptions.h (UNSUPPORTED_ERROR): Delete.
	* python/python.c (source_python_script) [!HAVE_PYTHON]: Internal
	error if called.
	* python/python.h (have_python): New static inline function.
2013-12-12 10:15:48 +00:00
..
cli-cmds.c Eliminate UNSUPPORTED_ERROR. 2013-12-12 10:15:48 +00:00
cli-cmds.h * gdbcmd.h (togglelist): Delete. 2013-07-17 19:01:48 +00:00
cli-decode.c remove gdb_string.h 2013-11-18 13:29:00 -07:00
cli-decode.h Constify strings in tracepoint.c, lookup_cmd and the completers. 2013-03-13 18:34:55 +00:00
cli-dump.c remove gdb_string.h 2013-11-18 13:29:00 -07:00
cli-interp.c remove gdb_string.h 2013-11-18 13:29:00 -07:00
cli-logging.c remove gdb_string.h 2013-11-18 13:29:00 -07:00
cli-script.c cli/cli-script.c (multi_line_command_p): New function. 2013-11-23 11:47:24 -08:00
cli-script.h Constify strings in tracepoint.c, lookup_cmd and the completers. 2013-03-13 18:34:55 +00:00
cli-setshow.c remove gdb_string.h 2013-11-18 13:29:00 -07:00
cli-setshow.h New commands "mt set per-command {space,time,symtab} {on,off}". 2013-03-21 17:37:30 +00:00
cli-utils.c remove gdb_string.h 2013-11-18 13:29:00 -07:00
cli-utils.h New function cli-utils.c:extract_arg_const 2013-11-14 14:31:42 +04:00