diff options
| author | Shannon McPherson <shannon@lunarg.com> | 2018-02-28 10:59:22 -0700 |
|---|---|---|
| committer | Shannon McPherson <shannon@lunarg.com> | 2018-02-28 11:43:17 -0700 |
| commit | 6336fcd486bc522722f94f490c72e201dc235068 (patch) | |
| tree | f0a87b54534259f62ba9227a3d5e9b14ad274815 | |
| parent | f846e216f89b5f6ac6d40ee86d25007a0ed87399 (diff) | |
| download | usermoji-6336fcd486bc522722f94f490c72e201dc235068.tar.xz | |
demos: Redirect error messages to stderr
Change-Id: Ib704cdc15eb681d1aa1c0a6cde55af5a9bdf3f0e
| -rw-r--r-- | demos/vulkaninfo.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/demos/vulkaninfo.c b/demos/vulkaninfo.c index 75b8c0d8..b69a6ba1 100644 --- a/demos/vulkaninfo.c +++ b/demos/vulkaninfo.c @@ -53,7 +53,7 @@ #include <vulkan/vulkan.h> -#define ERR(err) printf("%s:%d: failed with %s\n", __FILE__, __LINE__, VkResultString(err)); +#define ERR(err) fprintf(stderr, "%s:%d: failed with %s\n", __FILE__, __LINE__, VkResultString(err)); #ifdef _WIN32 @@ -80,6 +80,7 @@ static int ConsoleIsExclusive(void) { do { \ ERR(err); \ fflush(stdout); \ + fflush(stderr); \ WAIT_FOR_CONSOLE_DESTROY; \ exit(-1); \ } while (0) @@ -764,7 +765,7 @@ static void AppCreateInstance(struct AppInstance *inst) { VkResult U_ASSERT_ONLY err; err = vkCreateInstance(&inst_info, NULL, &inst->instance); if (err == VK_ERROR_INCOMPATIBLE_DRIVER) { - printf("Cannot create Vulkan instance.\n"); + fprintf(stderr, "Cannot create Vulkan instance.\n"); ERR_EXIT(err); } else if (err) { ERR_EXIT(err); @@ -940,8 +941,7 @@ static void AppCreateWin32Window(struct AppInstance *inst) { // Register window class: if (!RegisterClassEx(&win_class)) { // It didn't work, so try to give a useful error: - printf("Failed to register the window class!\n"); - fflush(stdout); + fprintf(stderr, "Failed to register the window class!\n"); exit(1); } // Create window with the registered class: @@ -961,8 +961,7 @@ static void AppCreateWin32Window(struct AppInstance *inst) { NULL); // no extra parameters if (!inst->h_wnd) { // It didn't work, so try to give a useful error: - printf("Failed to create a window!\n"); - fflush(stdout); + fprintf(stderr, "Failed to create a window!\n"); exit(1); } } @@ -1066,8 +1065,7 @@ static void AppCreateXlibWindow(struct AppInstance *inst) { inst->xlib_display = XOpenDisplay(NULL); if (inst->xlib_display == NULL) { - printf("XLib failed to connect to the X server.\nExiting ...\n"); - fflush(stdout); + fprintf(stderr, "XLib failed to connect to the X server.\nExiting ...\n"); exit(1); } @@ -2843,7 +2841,8 @@ int main(int argc, char **argv) { bool has_display = true; const char *display_var = getenv("DISPLAY"); if (display_var == NULL || strlen(display_var) == 0) { - printf("'DISPLAY' environment variable not set... skipping surface info\n"); + fprintf(stderr, "'DISPLAY' environment variable not set... skipping surface info\n"); + fflush(stderr); has_display = false; } #endif |
