diff options
author | Emil Velikov <[email protected]> | 2016-10-11 18:26:23 +0100 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2016-10-14 11:53:39 +0100 |
commit | 76ae842366f1da575e556f20cb06995228a2e92b (patch) | |
tree | 038b0e14c52cd3b97e6763fe25355f493463c700 /src/intel/genxml | |
parent | 72e70c00f3855fbeaeffa14d24f7b2c47dfe572b (diff) |
intel/genxml: use correct header guards
Signed-off-by: Emil Velikov <[email protected]>
Reviewed-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/intel/genxml')
-rw-r--r-- | src/intel/genxml/genX_pack.h | 5 | ||||
-rw-r--r-- | src/intel/genxml/gen_macros.h | 5 | ||||
-rw-r--r-- | src/intel/genxml/gen_pack_header.py | 22 |
3 files changed, 22 insertions, 10 deletions
diff --git a/src/intel/genxml/genX_pack.h b/src/intel/genxml/genX_pack.h index 0c25c4e94f4..2ec22269688 100644 --- a/src/intel/genxml/genX_pack.h +++ b/src/intel/genxml/genX_pack.h @@ -21,7 +21,8 @@ * IN THE SOFTWARE. */ -#pragma once +#ifndef GENX_PACK_H +#define GENX_PACK_H #ifndef GEN_VERSIONx10 # error "The GEN_VERSIONx10 macro must be defined" @@ -46,3 +47,5 @@ #else # error "Need to add a pack header include for this gen" #endif + +#endif /* GENX_PACK_H */ diff --git a/src/intel/genxml/gen_macros.h b/src/intel/genxml/gen_macros.h index 1d591fa8066..b4941b971ac 100644 --- a/src/intel/genxml/gen_macros.h +++ b/src/intel/genxml/gen_macros.h @@ -21,7 +21,8 @@ * IN THE SOFTWARE. */ -#pragma once +#ifndef GEN_MACROS_H +#define GEN_MACROS_H /* Macros for handling per-gen compilation. * @@ -87,3 +88,5 @@ #else # error "Need to add prefixing macros for this gen" #endif + +#endif /* GEN_MACROS_H */ diff --git a/src/intel/genxml/gen_pack_header.py b/src/intel/genxml/gen_pack_header.py index 01f20ad886b..83e3fde2daa 100644 --- a/src/intel/genxml/gen_pack_header.py +++ b/src/intel/genxml/gen_pack_header.py @@ -40,7 +40,8 @@ pack_header = """%(license)s * This file has been generated, do not hand edit. */ -#pragma once +#ifndef %(guard)s +#define %(guard)s #include <stdio.h> #include <stdint.h> @@ -485,11 +486,20 @@ class Parser(object): self.structs = {} self.registers = {} + def gen_prefix(self, name): + if name[0] == "_": + return 'GEN%s%s' % (self.gen, name) + else: + return 'GEN%s_%s' % (self.gen, name) + + def gen_guard(self): + return self.gen_prefix("PACK_H") + def start_element(self, name, attrs): if name == "genxml": self.platform = attrs["name"] self.gen = attrs["gen"].replace('.', '') - print(pack_header % {'license': license, 'platform': self.platform}) + print(pack_header % {'license': license, 'platform': self.platform, 'guard': self.gen_guard()}) elif name in ("instruction", "struct", "register"): if name == "instruction": self.instruction = safe_name(attrs["name"]) @@ -548,12 +558,8 @@ class Parser(object): elif name == "enum": self.emit_enum() self.enum = None - - def gen_prefix(self, name): - if name[0] == "_": - return 'GEN%s%s' % (self.gen, name) - else: - return 'GEN%s_%s' % (self.gen, name) + elif name == "genxml": + print('#endif /* %s */' % self.gen_guard()) def emit_template_struct(self, name, group): print("struct %s {" % self.gen_prefix(name)) |