[1/2] utils: ipc: Include <string> in generated headers where needed
diff mbox series

Message ID 20240902221317.19005-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit 0e333755ff3a27cfab4dcd5132b0c6dfe7a209aa
Headers show
Series
  • [1/2] utils: ipc: Include <string> in generated headers where needed
Related show

Commit Message

Laurent Pinchart Sept. 2, 2024, 10:13 p.m. UTC
Depending on the types used in the IPA interface, generated headers may
use the std::string class. Include <string> when needed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 .../libcamera_templates/core_ipa_interface.h.tmpl          | 1 +
 .../libcamera_templates/module_ipa_interface.h.tmpl        | 7 ++++---
 utils/codegen/ipc/generators/mojom_libcamera_generator.py  | 2 ++
 3 files changed, 7 insertions(+), 3 deletions(-)


base-commit: ac1c57fcf5dff06ae4e7e5fad7baa8f93c413e37

Comments

Milan Zamazal Sept. 3, 2024, 8:10 a.m. UTC | #1
Laurent Pinchart <laurent.pinchart@ideasonboard.com> writes:

> Depending on the types used in the IPA interface, generated headers may
> use the std::string class. Include <string> when needed.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Milan Zamazal <mzamazal@redhat.com>

> ---
>  .../libcamera_templates/core_ipa_interface.h.tmpl          | 1 +
>  .../libcamera_templates/module_ipa_interface.h.tmpl        | 7 ++++---
>  utils/codegen/ipc/generators/mojom_libcamera_generator.py  | 2 ++
>  3 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/utils/codegen/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl b/utils/codegen/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl
> index 7f2d0810823b..590135b88421 100644
> --- a/utils/codegen/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl
> +++ b/utils/codegen/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl
> @@ -15,6 +15,7 @@
>  #pragma once
>  
>  {% if has_map %}#include <map>{% endif %}
> +{% if has_string %}#include <string>{% endif %}
>  {% if has_array %}#include <vector>{% endif %}
>  
>  #include <libcamera/ipa/ipa_interface.h>
> diff --git a/utils/codegen/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl b/utils/codegen/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl
> index 4d88a3d77d0f..0111d0c4c591 100644
> --- a/utils/codegen/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl
> +++ b/utils/codegen/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl
> @@ -14,12 +14,13 @@
>  
>  #pragma once
>  
> +{% if has_map %}#include <map>{% endif %}
> +{% if has_string %}#include <string>{% endif %}
> +{% if has_array %}#include <vector>{% endif %}
> +
>  #include <libcamera/ipa/core_ipa_interface.h>
>  #include <libcamera/ipa/ipa_interface.h>
>  
> -{% if has_map %}#include <map>{% endif %}
> -{% if has_array %}#include <vector>{% endif %}
> -
>  namespace libcamera {
>  {%- if has_namespace %}
>  {% for ns in namespace %}
> diff --git a/utils/codegen/ipc/generators/mojom_libcamera_generator.py b/utils/codegen/ipc/generators/mojom_libcamera_generator.py
> index b8209e516297..d9c620a05e2a 100644
> --- a/utils/codegen/ipc/generators/mojom_libcamera_generator.py
> +++ b/utils/codegen/ipc/generators/mojom_libcamera_generator.py
> @@ -467,6 +467,7 @@ class Generator(generator.Generator):
>              'enums': self.module.enums,
>              'has_array': len([x for x in self.module.kinds.keys() if x[0] == 'a']) > 0,
>              'has_map': len([x for x in self.module.kinds.keys() if x[0] == 'm']) > 0,
> +            'has_string': len([x for x in self.module.kinds.keys() if x[0] == 's']) > 0,
>              'has_namespace': self.module.mojom_namespace != '',
>              'interface_event': GetEventInterface(self.module.interfaces),
>              'interface_main': GetMainInterface(self.module.interfaces),
> @@ -486,6 +487,7 @@ class Generator(generator.Generator):
>              'enums_gen_header': [x for x in self.module.enums if x.attributes is None or 'skipHeader' not in x.attributes],
>              'has_array': len([x for x in self.module.kinds.keys() if x[0] == 'a']) > 0,
>              'has_map': len([x for x in self.module.kinds.keys() if x[0] == 'm']) > 0,
> +            'has_string': len([x for x in self.module.kinds.keys() if x[0] == 's']) > 0,
>              'structs_gen_header': [x for x in self.module.structs if x.attributes is None or 'skipHeader' not in x.attributes],
>              'structs_gen_serializer': [x for x in self.module.structs if x.attributes is None or 'skipSerdes' not in x.attributes],
>          }
>
> base-commit: ac1c57fcf5dff06ae4e7e5fad7baa8f93c413e37
Kieran Bingham Sept. 4, 2024, 11:01 a.m. UTC | #2
Quoting Laurent Pinchart (2024-09-02 23:13:16)
> Depending on the types used in the IPA interface, generated headers may
> use the std::string class. Include <string> when needed.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  .../libcamera_templates/core_ipa_interface.h.tmpl          | 1 +
>  .../libcamera_templates/module_ipa_interface.h.tmpl        | 7 ++++---
>  utils/codegen/ipc/generators/mojom_libcamera_generator.py  | 2 ++
>  3 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/utils/codegen/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl b/utils/codegen/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl
> index 7f2d0810823b..590135b88421 100644
> --- a/utils/codegen/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl
> +++ b/utils/codegen/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl
> @@ -15,6 +15,7 @@
>  #pragma once
>  
>  {% if has_map %}#include <map>{% endif %}
> +{% if has_string %}#include <string>{% endif %}
>  {% if has_array %}#include <vector>{% endif %}
>  
>  #include <libcamera/ipa/ipa_interface.h>
> diff --git a/utils/codegen/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl b/utils/codegen/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl
> index 4d88a3d77d0f..0111d0c4c591 100644
> --- a/utils/codegen/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl
> +++ b/utils/codegen/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl
> @@ -14,12 +14,13 @@
>  
>  #pragma once
>  
> +{% if has_map %}#include <map>{% endif %}
> +{% if has_string %}#include <string>{% endif %}
> +{% if has_array %}#include <vector>{% endif %}
> +
>  #include <libcamera/ipa/core_ipa_interface.h>
>  #include <libcamera/ipa/ipa_interface.h>
>  
> -{% if has_map %}#include <map>{% endif %}
> -{% if has_array %}#include <vector>{% endif %}
> -
>  namespace libcamera {
>  {%- if has_namespace %}
>  {% for ns in namespace %}
> diff --git a/utils/codegen/ipc/generators/mojom_libcamera_generator.py b/utils/codegen/ipc/generators/mojom_libcamera_generator.py
> index b8209e516297..d9c620a05e2a 100644
> --- a/utils/codegen/ipc/generators/mojom_libcamera_generator.py
> +++ b/utils/codegen/ipc/generators/mojom_libcamera_generator.py
> @@ -467,6 +467,7 @@ class Generator(generator.Generator):
>              'enums': self.module.enums,
>              'has_array': len([x for x in self.module.kinds.keys() if x[0] == 'a']) > 0,
>              'has_map': len([x for x in self.module.kinds.keys() if x[0] == 'm']) > 0,
> +            'has_string': len([x for x in self.module.kinds.keys() if x[0] == 's']) > 0,
>              'has_namespace': self.module.mojom_namespace != '',
>              'interface_event': GetEventInterface(self.module.interfaces),
>              'interface_main': GetMainInterface(self.module.interfaces),
> @@ -486,6 +487,7 @@ class Generator(generator.Generator):
>              'enums_gen_header': [x for x in self.module.enums if x.attributes is None or 'skipHeader' not in x.attributes],
>              'has_array': len([x for x in self.module.kinds.keys() if x[0] == 'a']) > 0,
>              'has_map': len([x for x in self.module.kinds.keys() if x[0] == 'm']) > 0,
> +            'has_string': len([x for x in self.module.kinds.keys() if x[0] == 's']) > 0,
>              'structs_gen_header': [x for x in self.module.structs if x.attributes is None or 'skipHeader' not in x.attributes],
>              'structs_gen_serializer': [x for x in self.module.structs if x.attributes is None or 'skipSerdes' not in x.attributes],
>          }
> 
> base-commit: ac1c57fcf5dff06ae4e7e5fad7baa8f93c413e37
> -- 
> Regards,
> 
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/utils/codegen/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl b/utils/codegen/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl
index 7f2d0810823b..590135b88421 100644
--- a/utils/codegen/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl
+++ b/utils/codegen/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl
@@ -15,6 +15,7 @@ 
 #pragma once
 
 {% if has_map %}#include <map>{% endif %}
+{% if has_string %}#include <string>{% endif %}
 {% if has_array %}#include <vector>{% endif %}
 
 #include <libcamera/ipa/ipa_interface.h>
diff --git a/utils/codegen/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl b/utils/codegen/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl
index 4d88a3d77d0f..0111d0c4c591 100644
--- a/utils/codegen/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl
+++ b/utils/codegen/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl
@@ -14,12 +14,13 @@ 
 
 #pragma once
 
+{% if has_map %}#include <map>{% endif %}
+{% if has_string %}#include <string>{% endif %}
+{% if has_array %}#include <vector>{% endif %}
+
 #include <libcamera/ipa/core_ipa_interface.h>
 #include <libcamera/ipa/ipa_interface.h>
 
-{% if has_map %}#include <map>{% endif %}
-{% if has_array %}#include <vector>{% endif %}
-
 namespace libcamera {
 {%- if has_namespace %}
 {% for ns in namespace %}
diff --git a/utils/codegen/ipc/generators/mojom_libcamera_generator.py b/utils/codegen/ipc/generators/mojom_libcamera_generator.py
index b8209e516297..d9c620a05e2a 100644
--- a/utils/codegen/ipc/generators/mojom_libcamera_generator.py
+++ b/utils/codegen/ipc/generators/mojom_libcamera_generator.py
@@ -467,6 +467,7 @@  class Generator(generator.Generator):
             'enums': self.module.enums,
             'has_array': len([x for x in self.module.kinds.keys() if x[0] == 'a']) > 0,
             'has_map': len([x for x in self.module.kinds.keys() if x[0] == 'm']) > 0,
+            'has_string': len([x for x in self.module.kinds.keys() if x[0] == 's']) > 0,
             'has_namespace': self.module.mojom_namespace != '',
             'interface_event': GetEventInterface(self.module.interfaces),
             'interface_main': GetMainInterface(self.module.interfaces),
@@ -486,6 +487,7 @@  class Generator(generator.Generator):
             'enums_gen_header': [x for x in self.module.enums if x.attributes is None or 'skipHeader' not in x.attributes],
             'has_array': len([x for x in self.module.kinds.keys() if x[0] == 'a']) > 0,
             'has_map': len([x for x in self.module.kinds.keys() if x[0] == 'm']) > 0,
+            'has_string': len([x for x in self.module.kinds.keys() if x[0] == 's']) > 0,
             'structs_gen_header': [x for x in self.module.structs if x.attributes is None or 'skipHeader' not in x.attributes],
             'structs_gen_serializer': [x for x in self.module.structs if x.attributes is None or 'skipSerdes' not in x.attributes],
         }