head -r334749 breaks the FreeBSD-head-amd64-gcc ci.freebsd.org build [via pmc.h struct's having constructors in C++]

From: Mark Millard <marklmi_at_yahoo.com>
Date: Fri, 8 Jun 2018 16:08:16 -0700
[Note other build failures stopped builds before the below before
this was run into. Now those pass to reach the below.]

ci.free.bsd.org has FreeBSD-head-amd64-gcc failing for:

--- libpmc_json.o ---
In file included from /workspace/src/lib/libpmc/libpmc_json.cc:39:0:
/workspace/src/lib/libpmc/pmc.h:102:53: error: 'int pmc_cpuinfo(const pmc_cpuinfo**)' hides constructor for 'struct pmc_cpuinfo' [-Werror=shadow]
 int pmc_cpuinfo(const struct pmc_cpuinfo **_cpu_info);
                                                     ^
/workspace/src/lib/libpmc/pmc.h:103:57: error: 'int pmc_pmcinfo(int, pmc_pmcinfo**)' hides constructor for 'struct pmc_pmcinfo' [-Werror=shadow]
 int pmc_pmcinfo(int _cpu, struct pmc_pmcinfo **_pmc_info);
                                                         ^



With the .cc (so C++ context) the name of a struct is also the name
of the constructor for the struct. Having subroutines with that name
name ends up with the name shadowing the C++ constructor.

The builds are set up to reject such.

The struct's in pmc.h are:

struct pmc_cpuinfo {
	enum pmc_cputype pm_cputype;	/* the kind of CPU */
	uint32_t	pm_ncpu;	/* number of CPUs */
	uint32_t	pm_npmc;	/* #PMCs per CPU */
	uint32_t	pm_nclass;	/* #classes of PMCs */
	struct pmc_classinfo pm_classes[PMC_CLASS_MAX];
};

and:

struct pmc_pmcinfo {
	int32_t		pm_cpu;		/* CPU number */
	struct pmc_info	pm_pmcs[];	/* NPMC structs */
};




===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)
Received on Fri Jun 08 2018 - 21:08:28 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:16 UTC