[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] gnulib-tool.py: Fix output of #include directive advice.
From: |
Collin Funk |
Subject: |
[PATCH] gnulib-tool.py: Fix output of #include directive advice. |
Date: |
Mon, 25 Mar 2024 02:39:18 -0700 |
User-agent: |
Mozilla Thunderbird |
This patch fixes the following test failure:
./test-emacs-1.out tmp52599-out differ: byte 37757, line 896
--- ./test-emacs-1.out 2024-03-24 03:30:48.285074696 -0700
+++ tmp52599-out 2024-03-25 02:01:39.966937097 -0700
@@ -893,6 +893,10 @@
Finished.
You may need to add #include directives for the following .h files.
+ # include <sys/socket.h>
+ # include <ws2tcpip.h>
+ #elif HAVE_WS2TCPIP_H
+ #endif
#include <alloca.h>
#include <byteswap.h>
#include <dirent.h>
@@ -913,6 +917,7 @@
#include <sys/select.h>
#include <sys/stat.h>
#include <sys/time.h>
+ #include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include "acl.h"
@@ -947,12 +952,7 @@
#include "tempname.h"
#include "timespec.h"
#include "unlocked-io.h"
- #include <sys/types.h>
#if HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #elif HAVE_WS2TCPIP_H
- # include <ws2tcpip.h>
- #endif
The comments above this section of code are *slightly* misleading, so
I can see how it was written the way it is in gnulib-tool.py:
# First the #include <...> directives without #ifs, sorted for convenience,
# then the #include "..." directives without #ifs, sorted for convenience,
# then the #include directives that are surrounded by #ifs. Not sorted.
The incorrect behavior of gnulib-tool.py is because it processes each
'Include:' section line by line. The behavior of gnulib-tool.sh is to
first determine if the entire 'Include:' section contains #if's. If it
does than all lines are stored separately. If not all lines matching
'#include "*' are separated from those who don't.
I say that this is slightly misleading because #include <sys/types.h>
is after #include "..."'s even though it is not nested under an #if.
This is because of socklen and the actual process for sorting:
#include <sys/types.h>
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#elif HAVE_WS2TCPIP_H
# include <ws2tcpip.h>
#endif
Probably not worth changing the comment for that one exception though. :)
Collin
0002-gnulib-tool.py-Fix-output-of-include-directive-advic.patch
Description: Text Data