util: glsl2spirv.py: ensure '#endif' is printed in new line
authorMauro Rossi <issor.oruam@gmail.com>
Sat, 29 Oct 2022 10:46:49 +0000 (12:46 +0200)
committerMauro Rossi <issor.oruam@gmail.com>
Sun, 30 Oct 2022 13:14:21 +0000 (14:14 +0100)
Fixes the following building errors:

In file included from ../src/intel/vulkan/anv_pipeline_cache.c:34:
src/intel/vulkan/float64_spv.h:3316:3: error: expected identifier or '('
};#endif // FLOAT64_SPV_H
  ^
src/intel/vulkan/float64_spv.h:1:2: error: unterminated conditional directive
 ^
../src/intel/vulkan/anv_pipeline_cache.c:59:17: error: use of undeclared identifier 'anv_shader_bin_serialize'; did you mean 'anv_shader_bin_deserialize'?
   .serialize = anv_shader_bin_serialize,
                ^~~~~~~~~~~~~~~~~~~~~~~~
                anv_shader_bin_deserialize
../src/intel/vulkan/anv_pipeline_cache.c:41:1: note: 'anv_shader_bin_deserialize' declared here
anv_shader_bin_deserialize(struct vk_device *device,
^
../src/intel/vulkan/anv_pipeline_cache.c:59:17: error: incompatible pointer types initializing 'bool (*)(struct vk_pipeline_cache_object *, struct blob *)' with an expression of type 'struct vk_pipeline_cache_object *(struct vk_device *, const void *, size_t, struct blob_reader *)' (aka 'struct vk_pipeline_cache_object *(struct vk_device *, const void *, unsigned long, struct blob_reader *)') [-Werror,-Wincompatible-pointer-types]
   .serialize = anv_shader_bin_serialize,
                ^~~~~~~~~~~~~~~~~~~~~~~~
4 errors generated.

Fixes: 9786d9e ("util: Add glsl2spirv.py script")
Reviewed-by: Mykhailo Skorokhodov <mykhailo.skorokhodov@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19394>

src/util/glsl2spirv.py

index 02aba44..f11bf61 100644 (file)
@@ -69,7 +69,7 @@ def create_include_guard(lines, filename):
 
     guard_head = ["#ifndef {}\n".format(upper_name),
                   "#define {}\n".format(upper_name)]
-    guard_tail = ["#endif // {}\n".format(upper_name)]
+    guard_tail = ["\n#endif // {}\n".format(upper_name)]
 
     # remove '#pragma once'
     for idx, l in enumerate(lines):