aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource/common.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-12-27 10:56:12 +0100
committerDmitry Vyukov <dvyukov@google.com>2017-12-27 11:15:04 +0100
commitfd3e9f2b9720b9ba730938686b98cff3aa248984 (patch)
tree1bb89f1bc27e4dc16552a7dfff255788a1dd88db /pkg/csource/common.go
parent34c18f5f43b3b7804b5650b5af67100262557297 (diff)
executor: introduce uint64/32/16/8 types
The "define uint64_t unsigned long long" were too good to work. With a different toolchain I am getting: cstdint:69:11: error: expected unqualified-id using ::uint64_t; ^ executor/common.h:34:18: note: expanded from macro 'uint64_t' Do it the proper way: introduce uint64/32/16/8 types and use them. pkg/csource then does s/uint64/uint64_t/ to not clutter code with additional typedefs.
Diffstat (limited to 'pkg/csource/common.go')
-rw-r--r--pkg/csource/common.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/csource/common.go b/pkg/csource/common.go
index 6e46135e1..f0b940881 100644
--- a/pkg/csource/common.go
+++ b/pkg/csource/common.go
@@ -40,6 +40,16 @@ func createCommonHeader(p *prog.Prog, opts Options) ([]byte, error) {
if err != nil {
return nil, err
}
+
+ for from, to := range map[string]string{
+ "uint64": "uint64_t",
+ "uint32": "uint32_t",
+ "uint16": "uint16_t",
+ "uint8": "uint8_t",
+ } {
+ src = bytes.Replace(src, []byte(from), []byte(to), -1)
+ }
+
return src, nil
}