< prev index next >

src/share/vm/utilities/debug.cpp

Print this page




  64 #  endif // _DEBUG
  65 #endif // ASSERT
  66 
  67 
  68 #ifdef _DEBUG
  69 #  ifndef ASSERT
  70      configuration error: ASSERT must be defined in debug version
  71 #  endif // ASSERT
  72 #endif // _DEBUG
  73 
  74 
  75 #ifdef PRODUCT
  76 #  if -defined _DEBUG || -defined ASSERT
  77      configuration error: ASSERT et al. must not be defined in PRODUCT version
  78 #  endif
  79 #endif // PRODUCT
  80 
  81 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
  82 
  83 FormatBufferResource::FormatBufferResource(const char * format, ...)
  84   : FormatBufferBase((char*)resource_allocate_bytes(BUFSZ)) {
  85   va_list argp;
  86   va_start(argp, format);
  87   jio_vsnprintf(_buf, BUFSZ, format, argp);
  88   va_end(argp);
  89 }
  90 
  91 ATTRIBUTE_PRINTF(1, 2)
  92 void warning(const char* format, ...) {
  93   if (PrintWarnings) {
  94     FILE* const err = defaultStream::error_stream();
  95     jio_fprintf(err, "%s warning: ", VM_Version::vm_name());
  96     va_list ap;
  97     va_start(ap, format);
  98     vfprintf(err, format, ap);
  99     va_end(ap);
 100     fputc('\n', err);
 101   }
 102   if (BreakAtWarning) BREAKPOINT;
 103 }
 104 
 105 #ifndef PRODUCT
 106 
 107 #define is_token_break(ch) (isspace(ch) || (ch) == ',')




  64 #  endif // _DEBUG
  65 #endif // ASSERT
  66 
  67 
  68 #ifdef _DEBUG
  69 #  ifndef ASSERT
  70      configuration error: ASSERT must be defined in debug version
  71 #  endif // ASSERT
  72 #endif // _DEBUG
  73 
  74 
  75 #ifdef PRODUCT
  76 #  if -defined _DEBUG || -defined ASSERT
  77      configuration error: ASSERT et al. must not be defined in PRODUCT version
  78 #  endif
  79 #endif // PRODUCT
  80 
  81 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
  82 
  83 FormatBufferResource::FormatBufferResource(const char * format, ...)
  84   : FormatBufferBase((char*)resource_allocate_bytes(FormatBufferBase::BufferSize)) {
  85   va_list argp;
  86   va_start(argp, format);
  87   jio_vsnprintf(_buf, FormatBufferBase::BufferSize, format, argp);
  88   va_end(argp);
  89 }
  90 
  91 ATTRIBUTE_PRINTF(1, 2)
  92 void warning(const char* format, ...) {
  93   if (PrintWarnings) {
  94     FILE* const err = defaultStream::error_stream();
  95     jio_fprintf(err, "%s warning: ", VM_Version::vm_name());
  96     va_list ap;
  97     va_start(ap, format);
  98     vfprintf(err, format, ap);
  99     va_end(ap);
 100     fputc('\n', err);
 101   }
 102   if (BreakAtWarning) BREAKPOINT;
 103 }
 104 
 105 #ifndef PRODUCT
 106 
 107 #define is_token_break(ch) (isspace(ch) || (ch) == ',')


< prev index next >