Fix "dereferencing type-punned pointer" warnings

Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
Clifford Wolf 2018-06-22 20:19:29 +02:00
parent 8850f86a8a
commit 0508fb3627

View File

@ -122,33 +122,33 @@ PortPin Arch::portPinFromId(IdString type) const
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
static const ChipInfoPOD *get_chip_info(const RelPtr<ChipInfoPOD> *ptr)
{
return ptr->get();
}
Arch::Arch(ArchArgs args) : args(args) Arch::Arch(ArchArgs args) : args(args)
{ {
#ifdef ICE40_HX1K_ONLY #ifdef ICE40_HX1K_ONLY
if (args.type == ArchArgs::HX1K) { if (args.type == ArchArgs::HX1K) {
chip_info = chip_info = get_chip_info(
reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_1k) reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_1k));
->get();
} else { } else {
log_error("Unsupported iCE40 chip type.\n"); log_error("Unsupported iCE40 chip type.\n");
} }
#else #else
if (args.type == ArchArgs::LP384) { if (args.type == ArchArgs::LP384) {
chip_info = chip_info = get_chip_info(
reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_384) reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_384));
->get();
} else if (args.type == ArchArgs::LP1K || args.type == ArchArgs::HX1K) { } else if (args.type == ArchArgs::LP1K || args.type == ArchArgs::HX1K) {
chip_info = chip_info = get_chip_info(
reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_1k) reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_1k));
->get();
} else if (args.type == ArchArgs::UP5K) { } else if (args.type == ArchArgs::UP5K) {
chip_info = chip_info = get_chip_info(
reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_5k) reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_5k));
->get();
} else if (args.type == ArchArgs::LP8K || args.type == ArchArgs::HX8K) { } else if (args.type == ArchArgs::LP8K || args.type == ArchArgs::HX8K) {
chip_info = chip_info = get_chip_info(
reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_8k) reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_8k));
->get();
} else { } else {
log_error("Unsupported iCE40 chip type.\n"); log_error("Unsupported iCE40 chip type.\n");
} }