Skip to content

Commit 3c55dd5

Browse files
committed
hw/cpu: Clean up global variable shadowing
Fix: hw/core/machine.c:1302:22: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] const CPUArchId *cpus = possible_cpus->cpus; ^ hw/core/numa.c:69:17: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] uint16List *cpus = NULL; ^ hw/acpi/aml-build.c:2005:20: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] CPUArchIdList *cpus = ms->possible_cpus; ^ hw/core/machine-smp.c:77:14: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] unsigned cpus = config->has_cpus ? config->cpus : 0; ^ include/hw/core/cpu.h:589:17: note: previous declaration is here extern CPUTailQ cpus; ^ Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Ani Sinha <anisinha@redhat.com> Message-Id: <20231010115048.11856-2-philmd@linaro.org>
1 parent 79a9909 commit 3c55dd5

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

bsd-user/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void fork_end(int child)
118118
*/
119119
CPU_FOREACH_SAFE(cpu, next_cpu) {
120120
if (cpu != thread_cpu) {
121-
QTAILQ_REMOVE_RCU(&cpus, cpu, node);
121+
QTAILQ_REMOVE_RCU(&cpus_queue, cpu, node);
122122
}
123123
}
124124
mmap_fork_end(child);

cpu-common.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static int cpu_get_free_index(void)
7373
return max_cpu_index;
7474
}
7575

76-
CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
76+
CPUTailQ cpus_queue = QTAILQ_HEAD_INITIALIZER(cpus_queue);
7777
static unsigned int cpu_list_generation_id;
7878

7979
unsigned int cpu_list_generation_id_get(void)
@@ -90,7 +90,7 @@ void cpu_list_add(CPUState *cpu)
9090
} else {
9191
assert(!cpu_index_auto_assigned);
9292
}
93-
QTAILQ_INSERT_TAIL_RCU(&cpus, cpu, node);
93+
QTAILQ_INSERT_TAIL_RCU(&cpus_queue, cpu, node);
9494
cpu_list_generation_id++;
9595
}
9696

@@ -102,7 +102,7 @@ void cpu_list_remove(CPUState *cpu)
102102
return;
103103
}
104104

105-
QTAILQ_REMOVE_RCU(&cpus, cpu, node);
105+
QTAILQ_REMOVE_RCU(&cpus_queue, cpu, node);
106106
cpu->cpu_index = UNASSIGNED_CPU_INDEX;
107107
cpu_list_generation_id++;
108108
}

include/hw/core/cpu.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -586,13 +586,13 @@ static inline CPUArchState *cpu_env(CPUState *cpu)
586586
}
587587

588588
typedef QTAILQ_HEAD(CPUTailQ, CPUState) CPUTailQ;
589-
extern CPUTailQ cpus;
589+
extern CPUTailQ cpus_queue;
590590

591-
#define first_cpu QTAILQ_FIRST_RCU(&cpus)
591+
#define first_cpu QTAILQ_FIRST_RCU(&cpus_queue)
592592
#define CPU_NEXT(cpu) QTAILQ_NEXT_RCU(cpu, node)
593-
#define CPU_FOREACH(cpu) QTAILQ_FOREACH_RCU(cpu, &cpus, node)
593+
#define CPU_FOREACH(cpu) QTAILQ_FOREACH_RCU(cpu, &cpus_queue, node)
594594
#define CPU_FOREACH_SAFE(cpu, next_cpu) \
595-
QTAILQ_FOREACH_SAFE_RCU(cpu, &cpus, node, next_cpu)
595+
QTAILQ_FOREACH_SAFE_RCU(cpu, &cpus_queue, node, next_cpu)
596596

597597
extern __thread CPUState *current_cpu;
598598

linux-user/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void fork_end(int child)
156156
Discard information about the parent threads. */
157157
CPU_FOREACH_SAFE(cpu, next_cpu) {
158158
if (cpu != thread_cpu) {
159-
QTAILQ_REMOVE_RCU(&cpus, cpu, node);
159+
QTAILQ_REMOVE_RCU(&cpus_queue, cpu, node);
160160
}
161161
}
162162
qemu_init_cpu_list();

target/s390x/cpu_models.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ void s390_set_qemu_cpu_model(uint16_t type, uint8_t gen, uint8_t ec_ga,
757757
const S390CPUDef *def = s390_find_cpu_def(type, gen, ec_ga, NULL);
758758

759759
g_assert(def);
760-
g_assert(QTAILQ_EMPTY_RCU(&cpus));
760+
g_assert(QTAILQ_EMPTY_RCU(&cpus_queue));
761761

762762
/* build the CPU model */
763763
s390_qemu_cpu_model.def = def;

0 commit comments

Comments
 (0)