Skip to content

Commit 779492f

Browse files
committed
Qt: fix compile error when ODR check enabled.
when two structs with the same name, the linker many be confused. when LTO is enabled, ODR checked is required. ``` parallel_chip_info.cpp:36:3: error: type ‘struct Conf’ violates the C++ One Definition Rule [-Werror=odr] 36 | } Conf; | ^ spi_chip_info.cpp:20:3: note: a different type is defined in another translation unit 20 | } Conf; ``` Signed-off-by: Sasasu <[email protected]>
1 parent 20a5494 commit 779492f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

qt/parallel_chip_info.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ typedef struct __attribute__((__packed__))
3333
uint8_t enableEccAddr;
3434
uint8_t enableEccValue;
3535
uint8_t disableEccValue;
36-
} Conf;
36+
} ParallelChipConf;
3737

3838
ParallelChipInfo::ParallelChipInfo()
3939
{
@@ -120,7 +120,7 @@ void ParallelChipInfo::chipInfoToStmParams(StmParams *stmParams)
120120

121121
const QByteArray &ParallelChipInfo::getHalConf()
122122
{
123-
Conf conf;
123+
ParallelChipConf conf;
124124
StmParams stmParams;
125125

126126
chipInfoToStmParams(&stmParams);

qt/spi_chip_info.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ typedef struct __attribute__((__packed__))
1717
uint8_t busy_bit;
1818
uint8_t busy_state;
1919
uint32_t freq;
20-
} Conf;
20+
} SpiChipConf;
2121

2222
SpiChipInfo::SpiChipInfo()
2323
{
@@ -30,7 +30,7 @@ SpiChipInfo::~SpiChipInfo()
3030

3131
const QByteArray &SpiChipInfo::getHalConf()
3232
{
33-
Conf conf;
33+
SpiChipConf conf;
3434

3535
conf.page_offset = static_cast<uint8_t>(params[CHIP_PARAM_PAGE_OFF]);
3636
conf.read_cmd = static_cast<uint8_t>(params[CHIP_PARAM_READ_CMD]);

0 commit comments

Comments
 (0)