Skip to content

linebreak: Avoid implicit declaration of u8_mbtouc_unsafe function#16

Open
fweimer-rh wants to merge 1 commit intotux4kids:masterfrom
fweimer-rh:c99
Open

linebreak: Avoid implicit declaration of u8_mbtouc_unsafe function#16
fweimer-rh wants to merge 1 commit intotux4kids:masterfrom
fweimer-rh:c99

Conversation

@fweimer-rh
Copy link
Copy Markdown

GNULIB_UNISTR_U8_MBTOUC_UNSAFE tells the bundled unistr.h to provide a function prototype for u8_mbtouc_unsafe. This prevents build failures with future compilers which do not support implicit function declarations.

Upstream gnulib has split the linebreak module into multiple parts; it is hard to tell if it still has the same issue.

Related to:

https://fedoraproject.org/wiki/Changes/PortingToModernC
https://fedoraproject.org/wiki/Toolchain/PortingToModernC

GNULIB_UNISTR_U8_MBTOUC_UNSAFE tells the bundled unistr.h to
provide a function prototype for u8_mbtouc_unsafe.  This prevents
build failures with future compilers which do not support implicit
function declarations.

Upstream gnulib has split the linebreak module into multiple parts;
it is hard to tell if it still has the same issue.
@listout
Copy link
Copy Markdown

listout commented Feb 9, 2024

@fweimer-rh Thanks for the patch.

Along with this fix, I found we also need a little bit more fixing to be able to build with GCC 14

Bug: https://bugs.gentoo.org/923789
From: Brahmajit Das <brahmajit.xyz@gmail.com>
Date: Fri, 9 Feb 2024 11:49:53 +0530
Subject: [PATCH 2/2] t4k_menu: Fix passing incompatible pointer type

First observed under Gentoo Linux with GCC 14, probably due to
mismatching types between child (struct _xmlAttr *) and node.children
(struct _xmlAttr *).

Resulting in build errors such as
t4k_menu.c:254:23: error: assignment to 'xmlAttr *' {aka 'struct _xmlAttr *'} from incompatible pointer type 'struct _xmlNode *' [-Wincompatible-pointer-types]
  254 |             for(child = node->children; child; child = child->next) {
      |                       ^
t4k_menu.c:256:62: error: passing argument 1 of 'menu_TranslateNode' from incompatible pointer type [-Wincompatible-pointer-types]
  256 |                     tnode->submenu[i++] = menu_TranslateNode(child);
      |                                                              ^~~~~
      |                                                              |
      |                                                              xmlAttr * {aka struct _xmlAttr *}

Please reffer Gentoo bug: https://bugs.gentoo.org/923789
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
--- a/src/t4k_menu.c
+++ b/src/t4k_menu.c
@@ -251,9 +251,10 @@ MenuNode *menu_TranslateNode(xmlNode *node) {
         /* Now add child nodes. */
         if(xmlStrcasecmp(node->name, "menu") == 0) {
             i = 0;
-            for(child = node->children; child; child = child->next) {
-                if(child->type == XML_ELEMENT_NODE) {
-                    tnode->submenu[i++] = menu_TranslateNode(child);
+            xmlNode *childNode = NULL;
+            for(childNode = node->children; childNode; childNode = childNode->next) {
+                if(childNode->type == XML_ELEMENT_NODE) {
+                    tnode->submenu[i++] = menu_TranslateNode(childNode);
                 }
             }
         }
@@ -443,7 +444,7 @@ int T4K_RunMenu(int index, bool return_choice, void (*draw_background)(), int (*
   int click_flag = 1;
   int using_scroll = 0;
 
-  internal_res_switch_handler(&T4K_PrerenderAll);
+  internal_res_switch_handler((ResSwitchCallback)&T4K_PrerenderAll);
   
   for(;;) /* one loop body execution for one menu page */
   {
-- 
2.43.0

@listout
Copy link
Copy Markdown

listout commented May 1, 2024

(humble ping)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants