summaryrefslogtreecommitdiff
path: root/scripts/generator
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2018-01-06 19:32:54 +0100
committerCedric Nugteren <web@cedricnugteren.nl>2018-01-06 19:32:54 +0100
commit0c48c6e6c4cd953523a10bcb804fde67e4650a57 (patch)
tree8c7776049f2208bd1230340017bcc4e6be027a71 /scripts/generator
parent00687f8d81894dfc31be824601ac8159637ed468 (diff)
Fixed a minor nullptr related issue in the code generator
Diffstat (limited to 'scripts/generator')
-rw-r--r--scripts/generator/generator/cpp.py5
-rw-r--r--scripts/generator/generator/routine.py2
2 files changed, 4 insertions, 3 deletions
diff --git a/scripts/generator/generator/cpp.py b/scripts/generator/generator/cpp.py
index 656253d7..3631e737 100644
--- a/scripts/generator/generator/cpp.py
+++ b/scripts/generator/generator/cpp.py
@@ -61,8 +61,9 @@ def clblast_cc(routine, cuda=False):
if routine.batched:
result += " " + (NL + " ").join(routine.batched_transform_to_cpp()) + NL
if routine.temp_buffer:
- result += " const auto temp_buffer_provided = temp_buffer != nullptr;\n"
- result += " auto temp_buffer_cpp = temp_buffer_provided ? Buffer<T>(temp_buffer) : Buffer<T>(nullptr);\n"
+ null = "0" if cuda else "nullptr"
+ result += " const auto temp_buffer_provided = temp_buffer != " + null + ";\n"
+ result += " auto temp_buffer_cpp = temp_buffer_provided ? Buffer<T>(temp_buffer) : Buffer<T>(" + null + ");\n"
result += " routine.Do" + routine.capitalized_name() + "("
result += ("," + NL + indent1).join([a for a in routine.arguments_clcudaapi()])
if routine.temp_buffer:
diff --git a/scripts/generator/generator/routine.py b/scripts/generator/generator/routine.py
index 22be02b0..dd3c2ecb 100644
--- a/scripts/generator/generator/routine.py
+++ b/scripts/generator/generator/routine.py
@@ -822,7 +822,7 @@ class Routine:
if self.temp_buffer:
result += ",\n" + indent + mem_type + " temp_buffer"
if not implementation:
- result += " = nullptr"
+ result += " = 0" if cuda else " = nullptr"
result += ")"
return result