[gcjx] Patch: FYI: friendlier help with -j

Tom Tromey tromey@redhat.com
Tue Sep 13 00:26:00 GMT 2005


I'm checking this in on the gcjx branch.

There's no point in advertising the -j option unless it can actually
be used (which it can't, yet).  This disables the help when the
feature is not available.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* main.cc (argument_parser::help_options): Only print -j help if
	threads available.
	(argument_parser::parse_args): Throw better error if threads not
	available.
	* thread/thread.hh (concurrence::available): New function.

Index: main.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcjx/Attic/main.cc,v
retrieving revision 1.1.2.7
diff -u -r1.1.2.7 main.cc
--- main.cc 17 Apr 2005 18:33:54 -0000 1.1.2.7
+++ main.cc 13 Sep 2005 00:25:24 -0000
@@ -251,7 +251,8 @@
     print ("-source 1.[345]", "choose source code compatibility", 3);
     print ("-target 1.[345]", "choose target VM compatibility", 3);
     print ("-g", "generate debugging information", 3);
-    print ("-j N", "use N worker threads", 3);
+    if (concurrence::available ())
+      print ("-j N", "use N worker threads", 3);
 
     os << std::endl;
 
@@ -487,6 +488,8 @@
 	  dash_i_args.push_back (get_arg_for (it, "-I", false));
         else if (arg == "-j")
 	  {
+	    if (! concurrence::available ())
+	      throw make_error ("threads not available on this platform");
 	    std::string threads (get_next_arg (it, arg));
 	    n_threads = atoi (threads.c_str ());
 	  }
Index: thread/thread.hh
===================================================================
RCS file: /cvs/gcc/gcc/gcjx/thread/Attic/thread.hh,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 thread.hh
--- thread/thread.hh 13 Feb 2005 03:33:02 -0000 1.1.2.2
+++ thread/thread.hh 13 Sep 2005 00:25:24 -0000
@@ -161,6 +161,12 @@
   {
     return thread<T> (obj, fn);
   }
+
+  /// Return true if threads are available.
+  inline bool available ()
+  {
+    return false;
+  }
 };
 
 #endif // GCJX_THREAD_THREAD_HH



More information about the Java-patches mailing list