Mesa (master): anv: Update "do not edit" comments with proper filename

Dylan Baker dbaker at kemper.freedesktop.org
Wed Mar 22 23:22:24 UTC 2017


Module: Mesa
Branch: master
Commit: ba1085c6943e87868b712ea4a6adf9f161c48c97
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ba1085c6943e87868b712ea4a6adf9f161c48c97

Author: Dylan Baker <dylan at pnwbakers.com>
Date:   Fri Feb 24 08:47:54 2017 -0800

anv: Update "do not edit" comments with proper filename

This does two things, first it updates both the .h and the .c file to
have the same do not edit string. Second, it uses __file__ to ensure
that even if the file is moved or renamed that the name will be correct.

One thing to note is the use of '{{' and '}}' in the C template. This is
to instruct python to print a literal '{' and '}' respectively, rather
than treating the contents as a formatter specifier.

v3: - add this patch

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>

---

 src/intel/vulkan/anv_entrypoints_gen.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py
index c895492322..3bc9b46e2b 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -23,6 +23,7 @@
 #
 
 import argparse
+import os
 import textwrap
 import xml.etree.ElementTree as et
 
@@ -133,7 +134,8 @@ def get_entrypoints_defines(doc):
 
 
 def gen_header(entrypoints):
-    print "/* This file generated from vk_gen.py, don't edit directly. */\n"
+    print "/* This file generated from {}, don't edit directly. */\n".format(
+        os.path.basename(__file__))
 
     print "struct anv_dispatch_table {"
     print "   union {"
@@ -190,21 +192,21 @@ def gen_code(entrypoints):
      * IN THE SOFTWARE.
      */
 
-    /* DO NOT EDIT! This is a generated file. */
+    /* This file generated from {}, don't edit directly. */
 
     #include "anv_private.h"
 
-    struct anv_entrypoint {
+    struct anv_entrypoint {{
        uint32_t name;
        uint32_t hash;
-    };
+    }};
 
     /* We use a big string constant to avoid lots of reloctions from the entry
      * point table to lots of little strings. The entries in the entry point table
      * store the index into this big string.
      */
 
-    static const char strings[] =""")
+    static const char strings[] =""".format(os.path.basename(__file__)))
 
     offsets = []
     i = 0




More information about the mesa-commit mailing list