From 1a8216b7cd6f272253e7381bc520c65b7dd38b24 Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Thu, 26 Oct 2023 03:22:01 +0800 Subject: Fix warnings for gcc 12.3 (#3286) * Silence a few gcc out of bounds warnings * Search upwards from executable for prelude directory instead of assuming depth * comment wording * Check return values of read and write * Correct path to vulkan headers in gfx * Correct diagnostic on missing file in slang-embed * Do not use absolute path to libraries in test-context.cpp --------- Co-authored-by: Yong He --- tools/slang-generate/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tools/slang-generate/main.cpp') diff --git a/tools/slang-generate/main.cpp b/tools/slang-generate/main.cpp index 7d07cd613..af81385dd 100644 --- a/tools/slang-generate/main.cpp +++ b/tools/slang-generate/main.cpp @@ -809,7 +809,11 @@ SourceFile* parseSourceFile(const String& path) fseek(inputStream, 0, SEEK_SET); char* input = (char*)malloc(inputSize + 1); - fread(input, inputSize, 1, inputStream); + if(fread(input, inputSize, 1, inputStream) != 1) + { + fprintf(stderr, "unable to read input file: %s\n", path.getBuffer()); + return nullptr; + } input[inputSize] = 0; char const* inputEnd = input + inputSize; -- cgit v1.2.3