diff mbox series

Subject: [PATCH] Fix const definition without initialization

Message ID AM6PR03MB416574D2D264C136BA63C4C5C4BF0@AM6PR03MB4165.eurprd03.prod.outlook.com
State Not Applicable
Delegated to: David Oberhollenzer
Headers show
Series Subject: [PATCH] Fix const definition without initialization | expand

Commit Message

Hans Christian Lønstad May 13, 2020, 7:11 a.m. UTC
From: Hans Christian Lonstad <hcl@datarespons.no>
Date: Tue, 12 May 2020 15:58:40 +0200
Subject: [PATCH] Fix const definition without initialization

Compile error using g++ 9.3. Remove const specifier given the structure is filled in run-time.
---
 include/libmtd.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
2.25.1

Comments

David Oberhollenzer Oct. 18, 2020, 9 p.m. UTC | #1
Hi,

sorry for the delay. I must have missed this one on the ML but stumbled
over it today when going through the patchwork backlog.

Please use a prefix on the subject next time to highlight that this patch
is for mtd-utils.

Also, I had to fix some white space mangling to apply the patch on my end.

On 5/13/20 9:11 AM, Hans Christian Lønstad wrote:
> Compile error using g++ 9.3. Remove const specifier given the structure is filled in run-time.

Where do you get the compile error? Could you paste an error message?

I did a quick git-grep and it appears to me that the code that initializes
those fields explicitly casts the const away.

You wrote g++. Did you mean gcc or are you trying to force the C code through
a C++ compiler?

Thanks,

David
diff mbox series

Patch

diff --git a/include/libmtd.h b/include/libmtd.h
index cc24af8..dc339d1 100644
--- a/include/libmtd.h
+++ b/include/libmtd.h
@@ -77,8 +77,8 @@  struct mtd_dev_info
  int major;
  int minor;
  int type;
- const char type_str[MTD_TYPE_MAX + 1];
- const char name[MTD_NAME_MAX + 1];
+ char type_str[MTD_TYPE_MAX + 1];
+ char name[MTD_NAME_MAX + 1];
  long long size;
  int eb_cnt;
  int eb_size;