FelipeMdeO commented on code in PR #3532:
URL: https://github.com/apache/nuttx-apps/pull/3532#discussion_r3447643692
##########
netutils/dropbear/dropbear_main.c:
##########
@@ -0,0 +1,305 @@
+/****************************************************************************
+ * apps/netutils/dropbear/dropbear_main.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/socket.h>
+#include <setjmp.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "includes.h"
+#include "algo.h"
+#include "crypto_desc.h"
+#define dropbear_main dropbear_multi_entry
+#include "dbutil.h"
+#undef dropbear_main
Review Comment:
Sorry, I can't apply this change.
I tried this change and unfortunately it breaks the build. See Below:
```
CC: inode/fs_inoderemove.c <command-line>: error: conflicting types for
'dropbear_main'; have 'int(int, char **)'
dropbear_main.c:258:5: note: in expansion of macro 'main'
258 | int main(int argc, FAR char *argv[])
| ^~~~
In file included from dropbear_main.c:24:
/Users/felipemouradeoliveira/nuttxspace/apps/netutils/dropbear/dropbear/src/dbutil.h:110:5:
note: previous declaration of 'dropbear_main' with type 'int(int, char **,
const char *)'
110 | int dropbear_main(int argc, char ** argv, const char * multipath);
| ^~~~~~~~~~~~~
```
The NuttX build system injects -Dmain=dropbear_main at compile time, but
dbutil.h already declares dropbear_main with a different signature (3 args:
argc, argv, multipath). That causes a conflicting types error when int main(int
argc, ...) gets expanded.
The #define dropbear_main dropbear_multi_entry before the include is a trick
to silently rename that declaration to dropbear_multi_entry during
preprocessing, so the 3-arg version stays out of the way.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]