Philippe Mathieu-Daudé
88d2198c08
hw/sd: Declare QOM types using DEFINE_TYPES() macro
When multiple QOM types are registered in the same file,
it is simpler to use the the DEFINE_TYPES() macro. In
particular because type array declared with such macro
are easier to review.
Mechanical transformation using the following comby script:
[pattern-x1]
match='''
static const TypeInfo :[i1~.*_info] = {
:[body]
};
static void :[rt1~.*_register_type.](void)
{
type_register_static(&:[i2~.*_info]);
}
type_init(:[rt2~.*_register_type.])
'''
rewrite='''
static const TypeInfo :[i1][] = {
{
:[body]
},
};
DEFINE_TYPES(:[i1])
'''
rule='where :[i1] == :[i2], :[rt1] == :[rt2]'
[pattern-x2]
match='''
static const TypeInfo :[i1a~.*_info] = {
:[body1]
};
...
static const TypeInfo :[i2a~.*_info] = {
:[body2]
};
static void :[rt1~.*_register_type.](void)
{
type_register_static(&:[i1b~.*_info]);
type_register_static(&:[i2b~.*_info]);
}
type_init(:[rt2~.*_register_type.])
'''
rewrite='''
static const TypeInfo :[i1a][] = {
{
:[body1]
},
{
:[body2]
},
};
DEFINE_TYPES(:[i1a])
'''
rule='''
where
:[i1a] == :[i1b],
:[i2a] == :[i2b],
:[rt1] == :[rt2]
'''
and re-indented manually.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20231031080603.86889-2-philmd@linaro.org>
2023-11-07 13:08:49 +01:00
..
2023-11-03 09:20:31 +01:00
2023-11-07 13:08:49 +01:00
2023-11-06 10:03:45 +00:00
2023-11-03 10:04:12 +08:00
2023-11-07 13:08:48 +01:00
2023-11-07 09:41:34 +08:00
2023-11-06 18:49:34 -08:00
2023-11-07 09:41:52 +08:00
2023-11-07 13:08:49 +01:00
2023-11-07 09:42:07 +08:00
2023-11-07 13:08:48 +01:00
2023-11-03 10:04:12 +08:00
2023-11-03 09:57:32 +08:00
2023-11-07 13:08:48 +01:00
2023-11-02 07:26:06 +01:00
2023-11-06 13:54:57 +01:00
2023-11-02 14:42:03 +00:00
2023-11-03 09:20:31 +01:00
2023-11-07 15:01:17 +08:00
2023-11-07 12:13:28 +01:00
2023-11-03 09:20:31 +01:00
2023-11-07 11:06:02 +10:00
2023-11-06 15:00:27 +00:00
2023-11-07 13:08:48 +01:00
2023-11-01 16:13:59 +01:00
2023-11-07 13:08:49 +01:00
2023-11-07 13:08:49 +01:00
2023-11-07 11:06:02 +10:00
2023-11-06 13:23:23 +01:00
2023-11-07 09:41:52 +08:00
2023-11-02 13:36:45 +00:00