Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] package/prboom: fix build w/ gcc-14
@ 2025-08-12 17:18 Thomas Perale via buildroot
  2025-08-12 17:18 ` [Buildroot] [PATCH 2/2] package/prboom: fix build w/ gcc-15 Thomas Perale via buildroot
  2025-08-16 20:53 ` [Buildroot] [PATCH 1/2] package/prboom: fix build w/ gcc-14 Thomas Petazzoni via buildroot
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Perale via buildroot @ 2025-08-12 17:18 UTC (permalink / raw)
  To: buildroot

When building prboom with gcc-14 the following error appeared on the
autobuilder:

```
i_main.c: In function 'main':
i_main.c:359:10: error: assignment to 'const char * const*' from incompatible pointer type 'char **' [-Wincompatible-pointer-types]
  359 |   myargv = argv;
      |          ^
```

While this package did not receive any update for a while on the
sourceforge mirror, I backported the fix from a fork. For more
information see [1].

[1] https://github.com/coelckers/prboom-plus/commit/92d44b6383a3e053feac2c820b8114873fcd798e

Fixes: https://autobuild.buildroot.org/results/888/88846e3cb267b04da58bc17d92fd5dd385b65b5d
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
---
 ...v-instead-of-const-char-const-myargv.patch | 140 ++++++++++++++++++
 1 file changed, 140 insertions(+)
 create mode 100644 package/prboom/0003-gcc-warnings-const-myargv-instead-of-const-char-const-myargv.patch

diff --git a/package/prboom/0003-gcc-warnings-const-myargv-instead-of-const-char-const-myargv.patch b/package/prboom/0003-gcc-warnings-const-myargv-instead-of-const-char-const-myargv.patch
new file mode 100644
index 0000000000..b102175d59
--- /dev/null
+++ b/package/prboom/0003-gcc-warnings-const-myargv-instead-of-const-char-const-myargv.patch
@@ -0,0 +1,140 @@
+From 92d44b6383a3e053feac2c820b8114873fcd798e Mon Sep 17 00:00:00 2001
+From: entryway <entryway@localhost>
+Date: Fri, 10 Jun 2011 19:59:18 +0000
+Subject: [PATCH] gcc warnings: 'const **myargv' instead of 'const char * const
+ * myargv'
+
+Upstream: https://github.com/coelckers/prboom-plus/commit/92d44b6383a3e053feac2c820b8114873fcd798e
+[thomas: backport to 2.5.0]
+Signed-off-by: Thomas Perale <thomas.perale@mind.be>
+---
+ src/SDL/i_main.c |  3 ++-
+ src/d_main.c     | 20 ++++++++++++--------
+ src/m_argv.c     |  3 +--
+ src/m_argv.h     |  2 +-
+ 4 files changed, 16 insertions(+), 12 deletions(-)
+
+diff --git a/src/SDL/i_main.c b/src/SDL/i_main.c
+index 05cd655..1c19ef0 100644
+--- a/src/SDL/i_main.c
++++ b/src/SDL/i_main.c
+@@ -356,7 +356,8 @@ int main(int argc, char **argv)
+ #endif
+ 
+   myargc = argc;
+-  myargv = argv;
++  myargv = malloc(sizeof(myargv[0]) * myargc);
++  memcpy(myargv, argv, sizeof(myargv[0]) * myargc);
+ 
+ #ifdef _WIN32
+   if (!M_CheckParm("-nodraw")) {
+diff --git a/src/d_main.c b/src/d_main.c
+index 6d8493e..320e07a 100644
+--- a/src/d_main.c
++++ b/src/d_main.c
+@@ -870,7 +870,7 @@ static void FindResponseFile (void)
+ 	int indexinfile;
+         byte *file = NULL;
+         const char **moreargs = malloc(myargc * sizeof(const char*));
+-        const char **newargv;
++        char **newargv;
+         // proff 04/05/2000: Added for searching responsefile
+         char fname[PATH_MAX+1];
+ 
+@@ -904,14 +904,15 @@ static void FindResponseFile (void)
+ 	  int k;
+           lprintf(LO_ERROR,"\nResponse file empty!\n");
+ 
+-	  newargv = calloc(sizeof(char *),MAXARGVS);
++	  newargv = calloc(sizeof(newargv[0]),myargc);
+ 	  newargv[0] = myargv[0];
+           for (k = 1,index = 1;k < myargc;k++)
+           {
+             if (i!=k)
+               newargv[index++] = myargv[k];
+           }
+-          myargc = index; myargv = newargv;
++          myargc = index;
++          myargv = newargv;
+           return;
+         }
+ 
+@@ -919,8 +920,8 @@ static void FindResponseFile (void)
+ 	memcpy((void *)moreargs,&myargv[i+1],(index = myargc - i - 1) * sizeof(myargv[0]));
+ 
+ 	{
+-	  const char *firstargv = myargv[0];
+-	  newargv = calloc(sizeof(char *),MAXARGVS);
++	  char *firstargv = myargv[0];
++	  newargv = calloc(sizeof(newargv[0]), 1);
+ 	  newargv[0] = firstargv;
+ 	}
+ 
+@@ -949,16 +950,19 @@ static void FindResponseFile (void)
+ 
+ 	      // Terminate string, realloc and add to argv
+ 	      *p = 0;
++	      newargv = realloc(newargv, sizeof(newargv[0]) * (indexinfile + 1));
+ 	      newargv[indexinfile++] = realloc(s,strlen(s)+1);
+ 	    }
+ 	  } while(size > 0);
+ 	}
+ 	free(file);
+ 
++	newargv = realloc(newargv, sizeof(newargv[0]) * (indexinfile + index));
+ 	memcpy((void *)&newargv[indexinfile],moreargs,index*sizeof(moreargs[0]));
+ 	free((void *)moreargs);
+ 
+-        myargc = indexinfile+index; myargv = newargv;
++        myargc = indexinfile+index;
++        myargv = newargv;
+ 
+         // DISPLAY ARGS
+         //jff 9/3/98 use logical output routine
+@@ -999,7 +1003,7 @@ static void DoLooseFiles(void)
+   int lmpcount = 0;
+   int dehcount = 0;
+   int i,j,p;
+-  const char **tmyargv;  // use these to recreate the argv array
++  char **tmyargv;  // use these to recreate the argv array
+   int tmyargc;
+   boolean skip[MAXARGVS]; // CPhipps - should these be skipped at the end
+ 
+@@ -1060,7 +1064,7 @@ static void DoLooseFiles(void)
+ 
+   // Now go back and redo the whole myargv array with our stuff in it.
+   // First, create a new myargv array to copy into
+-  tmyargv = calloc(sizeof(char *),MAXARGVS);
++  tmyargv = calloc(sizeof(tmyargv[0]),MAXARGVS);
+   tmyargv[0] = myargv[0]; // invocation
+   tmyargc = 1;
+ 
+diff --git a/src/m_argv.c b/src/m_argv.c
+index 9392840..4fa1ed8 100644
+--- a/src/m_argv.c
++++ b/src/m_argv.c
+@@ -37,8 +37,7 @@
+ #include "m_argv.h"
+ 
+ int    myargc;
+-const char * const * myargv; // CPhipps - not sure if ANSI C allows you to
+-// modify contents of argv, but I can't imagine it does.
++char **myargv;
+ 
+ //
+ // M_CheckParm
+diff --git a/src/m_argv.h b/src/m_argv.h
+index 5340c15..b1d5907 100644
+--- a/src/m_argv.h
++++ b/src/m_argv.h
+@@ -39,7 +39,7 @@
+  * MISC
+  */
+ extern int  myargc;
+-extern const char * const * myargv; /* CPhipps - const * const * */
++extern char **myargv;
+ 
+ /* Returns the position of the given parameter in the arg list (0 if not found). */
+ int M_CheckParm(const char *check);
+-- 
+2.50.1
-- 
2.50.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH 2/2] package/prboom: fix build w/ gcc-15
  2025-08-12 17:18 [Buildroot] [PATCH 1/2] package/prboom: fix build w/ gcc-14 Thomas Perale via buildroot
@ 2025-08-12 17:18 ` Thomas Perale via buildroot
  2025-08-21 19:20   ` Thomas Perale via buildroot
  2025-08-16 20:53 ` [Buildroot] [PATCH 1/2] package/prboom: fix build w/ gcc-14 Thomas Petazzoni via buildroot
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Perale via buildroot @ 2025-08-12 17:18 UTC (permalink / raw)
  To: buildroot

This patch force the usage of `-std=gnu18` for GCC15 toolchains to fix
the following issues:

- The boolean issue with C23

```
In file included from ../../src/i_sound.h:38,
                 from i_sound.c:58:
../../src/doomtype.h:48:15: error: cannot use keyword ‘false’ as enumeration constant
   48 | typedef enum {false, true} boolean;
      |               ^~~~~
../../src/doomtype.h:48:15: note: ‘false’ is a keyword with ‘-std=c23’ onwards
```

- The usage of `usleep` & `struct timezone` require usage of GNU
  extensions.

```
i_system.c:58:3: error: implicit declaration of function ‘usleep’; did you mean ‘sleep’? [-Wimplicit-function-declaration]
   58 |   usleep(usecs);
      |   ^~~~~~
      |   sleep
i_system.c: In function ‘I_GetTime_RealTime’:
i_system.c:78:19: error: storage size of ‘tz’ isn’t known
   78 |   struct timezone tz;
      |                   ^~
i_system.c: In function ‘I_GetRandomTimeSeed’:
i_system.c:105:19: error: storage size of ‘tz’ isn’t known
  105 |   struct timezone tz;
      |                   ^~
```

Signed-off-by: Thomas Perale <thomas.perale@mind.be>
---
 package/prboom/prboom.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/prboom/prboom.mk b/package/prboom/prboom.mk
index fc440e5cf8..ab9ab09913 100644
--- a/package/prboom/prboom.mk
+++ b/package/prboom/prboom.mk
@@ -18,6 +18,10 @@ ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_85180),y)
 PRBOOM_CFLAGS += -O0
 endif
 
+ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_15),y)
+PRBOOM_CFLAGS += -std=gnu18
+endif
+
 PRBOOM_CONF_ENV += CFLAGS="$(PRBOOM_CFLAGS)"
 
 ifeq ($(BR2_PACKAGE_LIBPNG),y)
-- 
2.50.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH 1/2] package/prboom: fix build w/ gcc-14
  2025-08-12 17:18 [Buildroot] [PATCH 1/2] package/prboom: fix build w/ gcc-14 Thomas Perale via buildroot
  2025-08-12 17:18 ` [Buildroot] [PATCH 2/2] package/prboom: fix build w/ gcc-15 Thomas Perale via buildroot
@ 2025-08-16 20:53 ` Thomas Petazzoni via buildroot
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2025-08-16 20:53 UTC (permalink / raw)
  To: Thomas Perale via buildroot; +Cc: Thomas Perale

On Tue, 12 Aug 2025 19:18:24 +0200
Thomas Perale via buildroot <buildroot@buildroot.org> wrote:

> When building prboom with gcc-14 the following error appeared on the
> autobuilder:
> 
> ```
> i_main.c: In function 'main':
> i_main.c:359:10: error: assignment to 'const char * const*' from incompatible pointer type 'char **' [-Wincompatible-pointer-types]
>   359 |   myargv = argv;
>       |          ^
> ```
> 
> While this package did not receive any update for a while on the
> sourceforge mirror, I backported the fix from a fork. For more
> information see [1].
> 
> [1] https://github.com/coelckers/prboom-plus/commit/92d44b6383a3e053feac2c820b8114873fcd798e
> 
> Fixes: https://autobuild.buildroot.org/results/888/88846e3cb267b04da58bc17d92fd5dd385b65b5d
> Signed-off-by: Thomas Perale <thomas.perale@mind.be>
> ---
>  ...v-instead-of-const-char-const-myargv.patch | 140 ++++++++++++++++++
>  1 file changed, 140 insertions(+)
>  create mode 100644 package/prboom/0003-gcc-warnings-const-myargv-instead-of-const-char-const-myargv.patch

Both patches applied to master, thanks!

It's another package with no release since 2008, even the fork you took
the patch from is archived. I would suggest we drop it.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH 2/2] package/prboom: fix build w/ gcc-15
  2025-08-12 17:18 ` [Buildroot] [PATCH 2/2] package/prboom: fix build w/ gcc-15 Thomas Perale via buildroot
@ 2025-08-21 19:20   ` Thomas Perale via buildroot
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Perale via buildroot @ 2025-08-21 19:20 UTC (permalink / raw)
  To: Thomas Perale; +Cc: buildroot

In reply of:
> This patch force the usage of `-std=gnu18` for GCC15 toolchains to fix
> the following issues:
> 
> - The boolean issue with C23
> 
> ```
> In file included from ../../src/i_sound.h:38,
>                  from i_sound.c:58:
> ../../src/doomtype.h:48:15: error: cannot use keyword ‘false’ as enumeration constant
>    48 | typedef enum {false, true} boolean;
>       |               ^~~~~
> ../../src/doomtype.h:48:15: note: ‘false’ is a keyword with ‘-std=c23’ onwards
> ```
> 
> - The usage of `usleep` & `struct timezone` require usage of GNU
>   extensions.
> 
> ```
> i_system.c:58:3: error: implicit declaration of function ‘usleep’; did you mean ‘sleep’? [-Wimplicit-function-declaration]
>    58 |   usleep(usecs);
>       |   ^~~~~~
>       |   sleep
> i_system.c: In function ‘I_GetTime_RealTime’:
> i_system.c:78:19: error: storage size of ‘tz’ isn’t known
>    78 |   struct timezone tz;
>       |                   ^~
> i_system.c: In function ‘I_GetRandomTimeSeed’:
> i_system.c:105:19: error: storage size of ‘tz’ isn’t known
>   105 |   struct timezone tz;
>       |                   ^~
> ```
> 
> Signed-off-by: Thomas Perale <thomas.perale@mind.be>

Applied to 2025.02.x & 2025.05.x. Thanks

> ---
>  package/prboom/prboom.mk | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/package/prboom/prboom.mk b/package/prboom/prboom.mk
> index fc440e5cf8..ab9ab09913 100644
> --- a/package/prboom/prboom.mk
> +++ b/package/prboom/prboom.mk
> @@ -18,6 +18,10 @@ ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_85180),y)
>  PRBOOM_CFLAGS += -O0
>  endif
>  
> +ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_15),y)
> +PRBOOM_CFLAGS += -std=gnu18
> +endif
> +
>  PRBOOM_CONF_ENV += CFLAGS="$(PRBOOM_CFLAGS)"
>  
>  ifeq ($(BR2_PACKAGE_LIBPNG),y)
> -- 
> 2.50.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-21 19:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-12 17:18 [Buildroot] [PATCH 1/2] package/prboom: fix build w/ gcc-14 Thomas Perale via buildroot
2025-08-12 17:18 ` [Buildroot] [PATCH 2/2] package/prboom: fix build w/ gcc-15 Thomas Perale via buildroot
2025-08-21 19:20   ` Thomas Perale via buildroot
2025-08-16 20:53 ` [Buildroot] [PATCH 1/2] package/prboom: fix build w/ gcc-14 Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox