hotspot/src/share/vm/runtime/arguments.cpp
changeset 13194 603ef19adcb8
parent 12989 f4eb4085dead
child 13202 0a10221cc395
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Fri Jun 29 17:12:15 2012 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Mon Jul 02 10:54:17 2012 -0400
@@ -2971,7 +2971,10 @@
   const char* tail;
 
   // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed.
+  const char* hotspotrc = ".hotspotrc";
   bool settings_file_specified = false;
+  bool needs_hotspotrc_warning = false;
+
   const char* flags_file;
   int index;
   for (index = 0; index < args->nOptions; index++) {
@@ -3015,16 +3018,19 @@
     if (!process_settings_file(flags_file, true, args->ignoreUnrecognized)) {
       return JNI_EINVAL;
     }
-  }
-
+  } else {
 #ifdef ASSERT
-  // Parse default .hotspotrc settings file
-  if (!settings_file_specified) {
+    // Parse default .hotspotrc settings file
     if (!process_settings_file(".hotspotrc", false, args->ignoreUnrecognized)) {
       return JNI_EINVAL;
     }
+#else
+    struct stat buf;
+    if (os::stat(hotspotrc, &buf) == 0) {
+      needs_hotspotrc_warning = true;
+    }
+#endif
   }
-#endif
 
   if (PrintVMOptions) {
     for (index = 0; index < args->nOptions; index++) {
@@ -3041,6 +3047,14 @@
     return result;
   }
 
+  // Delay warning until here so that we've had a chance to process
+  // the -XX:-PrintWarnings flag
+  if (needs_hotspotrc_warning) {
+    warning("%s file is present but has been ignored.  "
+            "Run with -XX:Flags=%s to load the file.",
+            hotspotrc, hotspotrc);
+  }
+
 #if (defined JAVASE_EMBEDDED || defined ARM)
   UNSUPPORTED_OPTION(UseG1GC, "G1 GC");
 #endif