{"thread":{"id":"51800","subject":"[PATCH 0/2] cleanup compat/ sources using spatch","startedAt":"2019-09-04T11:09:48Z","lastAt":"2019-09-09T18:58:50Z","messageCount":8,"participants":["Denton Liu","Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"381797","messageId":"cover.1567595331.git.liu.denton@gmail.com","threadId":"51800","inReplyTo":null,"subject":"[PATCH 0/2] cleanup compat/ sources using spatch","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-09-04T11:09:42Z","receivedAt":"2019-09-04T11:09:48Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Sources under compat/ were excluded from cleanup using spatch since some\nof them were taken from an upstream and we didn't want to modify them so\nthat merging in future updates would be simpler. However, most of the\nfiles in compat/ were created by us so it should be safe to apply\ncleanup to those files.\n\n\nDenton Liu (2):\n  mingw: apply array.cocci rule\n  compat/*.[ch]: remove extern from function declarations using spatch\n\n compat/mingw.c         | 4 ++--\n compat/mingw.h         | 6 +++---\n compat/win32/pthread.h | 6 +++---\n 3 files changed, 8 insertions(+), 8 deletions(-)\n\n-- \n2.23.0.248.g3a9dd8fb08\n\n"},{"id":"381798","messageId":"dcb92cffd7bd0643e7af68d825f7517d490dcf16.1567595331.git.liu.denton@gmail.com","threadId":"51800","inReplyTo":"cover.1567595331.git.liu.denton@gmail.com","subject":"[PATCH 1/2] mingw: apply array.cocci rule","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-09-04T11:09:45Z","receivedAt":"2019-09-04T11:09:50Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"After running Coccinelle on all sources inside compat/ that were created\nby us[1], it was found that compat/mingw.c violated an array.cocci rule\nin two places and, thus, a patch was generated. Apply this patch so that\nall compat/ sources created by us follows all cocci rules.\n\n[1]: Do not run Coccinelle on files that are taken from some upstream\nbecause in case we need to pull updates from them, we would like to have\ndiverged as little as possible in order to make merging updates simpler.\n\nThe following sources were determined to have been taken from some\nupstream:\n\n* compat/regex/\n* compat/inet_ntop.c\n* compat/inet_pton.c\n* compat/nedmalloc/\n* compat/obstack.{c,h}\n* compat/poll/\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n compat/mingw.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex 738f0a826a..a3b1e9e3bb 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -1265,7 +1265,7 @@ static wchar_t *make_environment_block(char **deltaenv)\n \t\t}\n \n \t\tALLOC_ARRAY(result, size);\n-\t\tmemcpy(result, wenv, size * sizeof(*wenv));\n+\t\tCOPY_ARRAY(result, wenv, size);\n \t\tFreeEnvironmentStringsW(wenv);\n \t\treturn result;\n \t}\n@@ -1309,7 +1309,7 @@ static wchar_t *make_environment_block(char **deltaenv)\n \t\t\tcontinue;\n \n \t\tsize = wcslen(array[i]) + 1;\n-\t\tmemcpy(p, array[i], size * sizeof(*p));\n+\t\tCOPY_ARRAY(p, array[i], size);\n \t\tp += size;\n \t}\n \t*p = L'\\0';\n-- \n2.23.0.248.g3a9dd8fb08\n\n"},{"id":"381799","messageId":"3c08556231576d8dfe496b87ae8cdcb87c00df24.1567595331.git.liu.denton@gmail.com","threadId":"51800","inReplyTo":"cover.1567595331.git.liu.denton@gmail.com","subject":"[PATCH 2/2] compat/*.[ch]: remove extern from function declarations using spatch","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-09-04T11:09:48Z","receivedAt":"2019-09-04T11:09:52Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In 554544276a (*.[ch]: remove extern from function declarations using\nspatch, 2019-04-29), we removed externs from function declarations using\nspatch but we intentionally excluded files under compat/ since some are\ndirectly copied from an upstream and we should avoid churning them so\nthat manually merging future updates will be simpler.\n\nIn the last commit, we determined the files which taken from an upstream\nso we can exclude them and run spatch on the remainder.\n\nThis was the Coccinelle patch used:\n\n\t@@\n\ttype T;\n\tidentifier f;\n\t@@\n\t- extern\n\t  T f(...);\n\nand it was run with:\n\n\t$ git ls-files compat/\\*\\*.{c,h} |\n\t\txargs spatch --sp-file contrib/coccinelle/noextern.cocci --in-place\n\t$ git checkout -- \\\n\t\tcompat/regex/ \\\n\t\tcompat/inet_ntop.c \\\n\t\tcompat/inet_pton.c \\\n\t\tcompat/nedmalloc/ \\\n\t\tcompat/obstack.{c,h} \\\n\t\tcompat/poll/\n\nCoccinelle has some trouble dealing with `__attribute__` and varargs so\nwe ran the following to ensure that no remaining changes were left\nbehind:\n\n\t$ git ls-files compat/\\*\\*.{c,h} |\n\t\txargs sed -i'' -e 's/^\\(\\s*\\)extern \\([^(]*([^*]\\)/\\1\\2/'\n\t$ git checkout -- \\\n\t\tcompat/regex/ \\\n\t\tcompat/inet_ntop.c \\\n\t\tcompat/inet_pton.c \\\n\t\tcompat/nedmalloc/ \\\n\t\tcompat/obstack.{c,h} \\\n\t\tcompat/poll/\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n compat/mingw.h         | 6 +++---\n compat/win32/pthread.h | 6 +++---\n 2 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex a03e40e6e2..9ad204c57c 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -11,7 +11,7 @@ typedef _sigset_t sigset_t;\n #undef _POSIX_THREAD_SAFE_FUNCTIONS\n #endif\n \n-extern int mingw_core_config(const char *var, const char *value, void *cb);\n+int mingw_core_config(const char *var, const char *value, void *cb);\n #define platform_core_config mingw_core_config\n \n /*\n@@ -443,7 +443,7 @@ static inline void convert_slashes(char *path)\n \t\t\t*path = '/';\n }\n #define PATH_SEP ';'\n-extern char *mingw_query_user_email(void);\n+char *mingw_query_user_email(void);\n #define query_user_email mingw_query_user_email\n #if !defined(__MINGW64_VERSION_MAJOR) && (!defined(_MSC_VER) || _MSC_VER < 1800)\n #define PRIuMAX \"I64u\"\n@@ -580,4 +580,4 @@ int main(int argc, const char **argv);\n /*\n  * Used by Pthread API implementation for Windows\n  */\n-extern int err_win_to_posix(DWORD winerr);\n+int err_win_to_posix(DWORD winerr);\ndiff --git a/compat/win32/pthread.h b/compat/win32/pthread.h\nindex c6cb8dd219..f1cfe73de9 100644\n--- a/compat/win32/pthread.h\n+++ b/compat/win32/pthread.h\n@@ -50,7 +50,7 @@ typedef struct {\n \tDWORD tid;\n } pthread_t;\n \n-extern int pthread_create(pthread_t *thread, const void *unused,\n+int pthread_create(pthread_t *thread, const void *unused,\n \t\t\t  void *(*start_routine)(void*), void *arg);\n \n /*\n@@ -59,10 +59,10 @@ extern int pthread_create(pthread_t *thread, const void *unused,\n  */\n #define pthread_join(a, b) win32_pthread_join(&(a), (b))\n \n-extern int win32_pthread_join(pthread_t *thread, void **value_ptr);\n+int win32_pthread_join(pthread_t *thread, void **value_ptr);\n \n #define pthread_equal(t1, t2) ((t1).tid == (t2).tid)\n-extern pthread_t pthread_self(void);\n+pthread_t pthread_self(void);\n \n static inline void NORETURN pthread_exit(void *ret)\n {\n-- \n2.23.0.248.g3a9dd8fb08\n\n"},{"id":"381837","messageId":"nycvar.QRO.7.76.6.1909042340520.5377@tvgsbejvaqbjf.bet","threadId":"51800","inReplyTo":"dcb92cffd7bd0643e7af68d825f7517d490dcf16.1567595331.git.liu.denton@gmail.com","subject":"Re: [PATCH 1/2] mingw: apply array.cocci rule","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-09-04T21:41:24Z","receivedAt":"2019-09-04T21:41:42Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Denton,\n\nOn Wed, 4 Sep 2019, Denton Liu wrote:\n\n> After running Coccinelle on all sources inside compat/ that were created\n> by us[1], it was found that compat/mingw.c violated an array.cocci rule\n> in two places and, thus, a patch was generated. Apply this patch so that\n> all compat/ sources created by us follows all cocci rules.\n>\n> [1]: Do not run Coccinelle on files that are taken from some upstream\n> because in case we need to pull updates from them, we would like to have\n> diverged as little as possible in order to make merging updates simpler.\n>\n> The following sources were determined to have been taken from some\n> upstream:\n>\n> * compat/regex/\n> * compat/inet_ntop.c\n> * compat/inet_pton.c\n> * compat/nedmalloc/\n> * compat/obstack.{c,h}\n> * compat/poll/\n>\n> Signed-off-by: Denton Liu <liu.denton@gmail.com>\n> ---\n>  compat/mingw.c | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/compat/mingw.c b/compat/mingw.c\n> index 738f0a826a..a3b1e9e3bb 100644\n> --- a/compat/mingw.c\n> +++ b/compat/mingw.c\n> @@ -1265,7 +1265,7 @@ static wchar_t *make_environment_block(char **deltaenv)\n>  \t\t}\n>\n>  \t\tALLOC_ARRAY(result, size);\n> -\t\tmemcpy(result, wenv, size * sizeof(*wenv));\n> +\t\tCOPY_ARRAY(result, wenv, size);\n>  \t\tFreeEnvironmentStringsW(wenv);\n>  \t\treturn result;\n>  \t}\n> @@ -1309,7 +1309,7 @@ static wchar_t *make_environment_block(char **deltaenv)\n>  \t\t\tcontinue;\n>\n>  \t\tsize = wcslen(array[i]) + 1;\n> -\t\tmemcpy(p, array[i], size * sizeof(*p));\n> +\t\tCOPY_ARRAY(p, array[i], size);\n\nACK!\n\nThanks,\nDscho\n\n>  \t\tp += size;\n>  \t}\n>  \t*p = L'\\0';\n> --\n> 2.23.0.248.g3a9dd8fb08\n>\n>\n"},{"id":"381838","messageId":"nycvar.QRO.7.76.6.1909042342220.5377@tvgsbejvaqbjf.bet","threadId":"51800","inReplyTo":"3c08556231576d8dfe496b87ae8cdcb87c00df24.1567595331.git.liu.denton@gmail.com","subject":"Re: [PATCH 2/2] compat/*.[ch]: remove extern from function declarations using spatch","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-09-04T21:43:06Z","receivedAt":"2019-09-04T21:43:24Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Denton,\n\nOn Wed, 4 Sep 2019, Denton Liu wrote:\n\n> In 554544276a (*.[ch]: remove extern from function declarations using\n> spatch, 2019-04-29), we removed externs from function declarations using\n> spatch but we intentionally excluded files under compat/ since some are\n> directly copied from an upstream and we should avoid churning them so\n> that manually merging future updates will be simpler.\n>\n> In the last commit, we determined the files which taken from an upstream\n> so we can exclude them and run spatch on the remainder.\n>\n> This was the Coccinelle patch used:\n>\n> \t@@\n> \ttype T;\n> \tidentifier f;\n> \t@@\n> \t- extern\n> \t  T f(...);\n>\n> and it was run with:\n>\n> \t$ git ls-files compat/\\*\\*.{c,h} |\n> \t\txargs spatch --sp-file contrib/coccinelle/noextern.cocci --in-place\n> \t$ git checkout -- \\\n> \t\tcompat/regex/ \\\n> \t\tcompat/inet_ntop.c \\\n> \t\tcompat/inet_pton.c \\\n> \t\tcompat/nedmalloc/ \\\n> \t\tcompat/obstack.{c,h} \\\n> \t\tcompat/poll/\n>\n> Coccinelle has some trouble dealing with `__attribute__` and varargs so\n> we ran the following to ensure that no remaining changes were left\n> behind:\n>\n> \t$ git ls-files compat/\\*\\*.{c,h} |\n> \t\txargs sed -i'' -e 's/^\\(\\s*\\)extern \\([^(]*([^*]\\)/\\1\\2/'\n> \t$ git checkout -- \\\n> \t\tcompat/regex/ \\\n> \t\tcompat/inet_ntop.c \\\n> \t\tcompat/inet_pton.c \\\n> \t\tcompat/nedmalloc/ \\\n> \t\tcompat/obstack.{c,h} \\\n> \t\tcompat/poll/\n\nI wonder whether we want to make this part of the (slightly misnamed)\n\"Static Analysis\" job in our CI.\n\n>\n> Signed-off-by: Denton Liu <liu.denton@gmail.com>\n> ---\n>  compat/mingw.h         | 6 +++---\n>  compat/win32/pthread.h | 6 +++---\n>  2 files changed, 6 insertions(+), 6 deletions(-)\n>\n> diff --git a/compat/mingw.h b/compat/mingw.h\n> index a03e40e6e2..9ad204c57c 100644\n> --- a/compat/mingw.h\n> +++ b/compat/mingw.h\n> @@ -11,7 +11,7 @@ typedef _sigset_t sigset_t;\n>  #undef _POSIX_THREAD_SAFE_FUNCTIONS\n>  #endif\n>\n> -extern int mingw_core_config(const char *var, const char *value, void *cb);\n> +int mingw_core_config(const char *var, const char *value, void *cb);\n>  #define platform_core_config mingw_core_config\n>\n>  /*\n> @@ -443,7 +443,7 @@ static inline void convert_slashes(char *path)\n>  \t\t\t*path = '/';\n>  }\n>  #define PATH_SEP ';'\n> -extern char *mingw_query_user_email(void);\n> +char *mingw_query_user_email(void);\n>  #define query_user_email mingw_query_user_email\n>  #if !defined(__MINGW64_VERSION_MAJOR) && (!defined(_MSC_VER) || _MSC_VER < 1800)\n>  #define PRIuMAX \"I64u\"\n> @@ -580,4 +580,4 @@ int main(int argc, const char **argv);\n>  /*\n>   * Used by Pthread API implementation for Windows\n>   */\n> -extern int err_win_to_posix(DWORD winerr);\n> +int err_win_to_posix(DWORD winerr);\n> diff --git a/compat/win32/pthread.h b/compat/win32/pthread.h\n> index c6cb8dd219..f1cfe73de9 100644\n> --- a/compat/win32/pthread.h\n> +++ b/compat/win32/pthread.h\n> @@ -50,7 +50,7 @@ typedef struct {\n>  \tDWORD tid;\n>  } pthread_t;\n>\n> -extern int pthread_create(pthread_t *thread, const void *unused,\n> +int pthread_create(pthread_t *thread, const void *unused,\n>  \t\t\t  void *(*start_routine)(void*), void *arg);\n>\n>  /*\n> @@ -59,10 +59,10 @@ extern int pthread_create(pthread_t *thread, const void *unused,\n>   */\n>  #define pthread_join(a, b) win32_pthread_join(&(a), (b))\n>\n> -extern int win32_pthread_join(pthread_t *thread, void **value_ptr);\n> +int win32_pthread_join(pthread_t *thread, void **value_ptr);\n>\n>  #define pthread_equal(t1, t2) ((t1).tid == (t2).tid)\n> -extern pthread_t pthread_self(void);\n> +pthread_t pthread_self(void);\n\nACK!\n\nThanks,\nDscho\n\n>\n>  static inline void NORETURN pthread_exit(void *ret)\n>  {\n> --\n> 2.23.0.248.g3a9dd8fb08\n>\n>\n"},{"id":"381851","messageId":"xmqq36hbskg6.fsf@gitster-ct.c.googlers.com","threadId":"51800","inReplyTo":"nycvar.QRO.7.76.6.1909042340520.5377@tvgsbejvaqbjf.bet","subject":"Re: [PATCH 1/2] mingw: apply array.cocci rule","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-09-04T23:36:25Z","receivedAt":"2019-09-04T23:36:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Hi Denton,\n>\n> On Wed, 4 Sep 2019, Denton Liu wrote:\n>\n>> After running Coccinelle on all sources inside compat/ that were created\n>> by us[1], it was found that compat/mingw.c violated an array.cocci rule\n>> in two places and, thus, a patch was generated. Apply this patch so that\n>> all compat/ sources created by us follows all cocci rules.\n>>\n>> [1]: Do not run Coccinelle on files that are taken from some upstream\n>> because in case we need to pull updates from them, we would like to have\n>> diverged as little as possible in order to make merging updates simpler.\n>>\n>> The following sources were determined to have been taken from some\n>> upstream:\n>>\n>> * compat/regex/\n>> * compat/inet_ntop.c\n>> * compat/inet_pton.c\n>> * compat/nedmalloc/\n>> * compat/obstack.{c,h}\n>> * compat/poll/\n>>\n>> Signed-off-by: Denton Liu <liu.denton@gmail.com>\n>> ---\n>>  compat/mingw.c | 4 ++--\n>>  1 file changed, 2 insertions(+), 2 deletions(-)\n>>\n>> diff --git a/compat/mingw.c b/compat/mingw.c\n>> index 738f0a826a..a3b1e9e3bb 100644\n>> --- a/compat/mingw.c\n>> +++ b/compat/mingw.c\n>> @@ -1265,7 +1265,7 @@ static wchar_t *make_environment_block(char **deltaenv)\n>>  \t\t}\n>>\n>>  \t\tALLOC_ARRAY(result, size);\n>> -\t\tmemcpy(result, wenv, size * sizeof(*wenv));\n>> +\t\tCOPY_ARRAY(result, wenv, size);\n>>  \t\tFreeEnvironmentStringsW(wenv);\n>>  \t\treturn result;\n>>  \t}\n>> @@ -1309,7 +1309,7 @@ static wchar_t *make_environment_block(char **deltaenv)\n>>  \t\t\tcontinue;\n>>\n>>  \t\tsize = wcslen(array[i]) + 1;\n>> -\t\tmemcpy(p, array[i], size * sizeof(*p));\n>> +\t\tCOPY_ARRAY(p, array[i], size);\n>\n> ACK!\n>\n> Thanks,\n> Dscho\n\nYup, looks good.  Thanks both.\n"},{"id":"381853","messageId":"20190905032317.GA1381@archbookpro.localdomain","threadId":"51800","inReplyTo":"nycvar.QRO.7.76.6.1909042342220.5377@tvgsbejvaqbjf.bet","subject":"Re: [PATCH 2/2] compat/*.[ch]: remove extern from function declarations using spatch","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-09-05T03:23:17Z","receivedAt":"2019-09-05T03:23:22Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Hi Dscho,\n\nOn Wed, Sep 04, 2019 at 11:43:06PM +0200, Johannes Schindelin wrote:\n> Hi Denton,\n> \n> On Wed, 4 Sep 2019, Denton Liu wrote:\n> \n> > In 554544276a (*.[ch]: remove extern from function declarations using\n> > spatch, 2019-04-29), we removed externs from function declarations using\n> > spatch but we intentionally excluded files under compat/ since some are\n> > directly copied from an upstream and we should avoid churning them so\n> > that manually merging future updates will be simpler.\n> >\n> > In the last commit, we determined the files which taken from an upstream\n> > so we can exclude them and run spatch on the remainder.\n> >\n> > This was the Coccinelle patch used:\n> >\n> > \t@@\n> > \ttype T;\n> > \tidentifier f;\n> > \t@@\n> > \t- extern\n> > \t  T f(...);\n> >\n> > and it was run with:\n> >\n> > \t$ git ls-files compat/\\*\\*.{c,h} |\n> > \t\txargs spatch --sp-file contrib/coccinelle/noextern.cocci --in-place\n> > \t$ git checkout -- \\\n> > \t\tcompat/regex/ \\\n> > \t\tcompat/inet_ntop.c \\\n> > \t\tcompat/inet_pton.c \\\n> > \t\tcompat/nedmalloc/ \\\n> > \t\tcompat/obstack.{c,h} \\\n> > \t\tcompat/poll/\n> >\n> > Coccinelle has some trouble dealing with `__attribute__` and varargs so\n> > we ran the following to ensure that no remaining changes were left\n> > behind:\n> >\n> > \t$ git ls-files compat/\\*\\*.{c,h} |\n> > \t\txargs sed -i'' -e 's/^\\(\\s*\\)extern \\([^(]*([^*]\\)/\\1\\2/'\n> > \t$ git checkout -- \\\n> > \t\tcompat/regex/ \\\n> > \t\tcompat/inet_ntop.c \\\n> > \t\tcompat/inet_pton.c \\\n> > \t\tcompat/nedmalloc/ \\\n> > \t\tcompat/obstack.{c,h} \\\n> > \t\tcompat/poll/\n> \n> I wonder whether we want to make this part of the (slightly misnamed)\n> \"Static Analysis\" job in our CI.\n\nDo you mean running cocci on all of our source files as opposed to just\nthe files we compile? These two patches are part of an experimental (and\nunsubmitted) patchset that does exactly that. Seeing that there's\ninterest, I'll try to send it in soon.\n\nThanks,\n\nDenton\n\n> \n> >\n> > Signed-off-by: Denton Liu <liu.denton@gmail.com>\n> > ---\n> >  compat/mingw.h         | 6 +++---\n> >  compat/win32/pthread.h | 6 +++---\n> >  2 files changed, 6 insertions(+), 6 deletions(-)\n> >\n> > diff --git a/compat/mingw.h b/compat/mingw.h\n> > index a03e40e6e2..9ad204c57c 100644\n> > --- a/compat/mingw.h\n> > +++ b/compat/mingw.h\n> > @@ -11,7 +11,7 @@ typedef _sigset_t sigset_t;\n> >  #undef _POSIX_THREAD_SAFE_FUNCTIONS\n> >  #endif\n> >\n> > -extern int mingw_core_config(const char *var, const char *value, void *cb);\n> > +int mingw_core_config(const char *var, const char *value, void *cb);\n> >  #define platform_core_config mingw_core_config\n> >\n> >  /*\n> > @@ -443,7 +443,7 @@ static inline void convert_slashes(char *path)\n> >  \t\t\t*path = '/';\n> >  }\n> >  #define PATH_SEP ';'\n> > -extern char *mingw_query_user_email(void);\n> > +char *mingw_query_user_email(void);\n> >  #define query_user_email mingw_query_user_email\n> >  #if !defined(__MINGW64_VERSION_MAJOR) && (!defined(_MSC_VER) || _MSC_VER < 1800)\n> >  #define PRIuMAX \"I64u\"\n> > @@ -580,4 +580,4 @@ int main(int argc, const char **argv);\n> >  /*\n> >   * Used by Pthread API implementation for Windows\n> >   */\n> > -extern int err_win_to_posix(DWORD winerr);\n> > +int err_win_to_posix(DWORD winerr);\n> > diff --git a/compat/win32/pthread.h b/compat/win32/pthread.h\n> > index c6cb8dd219..f1cfe73de9 100644\n> > --- a/compat/win32/pthread.h\n> > +++ b/compat/win32/pthread.h\n> > @@ -50,7 +50,7 @@ typedef struct {\n> >  \tDWORD tid;\n> >  } pthread_t;\n> >\n> > -extern int pthread_create(pthread_t *thread, const void *unused,\n> > +int pthread_create(pthread_t *thread, const void *unused,\n> >  \t\t\t  void *(*start_routine)(void*), void *arg);\n> >\n> >  /*\n> > @@ -59,10 +59,10 @@ extern int pthread_create(pthread_t *thread, const void *unused,\n> >   */\n> >  #define pthread_join(a, b) win32_pthread_join(&(a), (b))\n> >\n> > -extern int win32_pthread_join(pthread_t *thread, void **value_ptr);\n> > +int win32_pthread_join(pthread_t *thread, void **value_ptr);\n> >\n> >  #define pthread_equal(t1, t2) ((t1).tid == (t2).tid)\n> > -extern pthread_t pthread_self(void);\n> > +pthread_t pthread_self(void);\n> \n> ACK!\n> \n> Thanks,\n> Dscho\n> \n> >\n> >  static inline void NORETURN pthread_exit(void *ret)\n> >  {\n> > --\n> > 2.23.0.248.g3a9dd8fb08\n> >\n> >\n"},{"id":"382090","messageId":"nycvar.QRO.7.76.6.1909092058020.5377@tvgsbejvaqbjf.bet","threadId":"51800","inReplyTo":"20190905032317.GA1381@archbookpro.localdomain","subject":"Re: [PATCH 2/2] compat/*.[ch]: remove extern from function declarations using spatch","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-09-09T18:58:31Z","receivedAt":"2019-09-09T18:58:50Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Denton,\n\nOn Wed, 4 Sep 2019, Denton Liu wrote:\n\n> On Wed, Sep 04, 2019 at 11:43:06PM +0200, Johannes Schindelin wrote:\n> >\n> > On Wed, 4 Sep 2019, Denton Liu wrote:\n> >\n> > > In 554544276a (*.[ch]: remove extern from function declarations using\n> > > spatch, 2019-04-29), we removed externs from function declarations using\n> > > spatch but we intentionally excluded files under compat/ since some are\n> > > directly copied from an upstream and we should avoid churning them so\n> > > that manually merging future updates will be simpler.\n> > >\n> > > In the last commit, we determined the files which taken from an upstream\n> > > so we can exclude them and run spatch on the remainder.\n> > >\n> > > This was the Coccinelle patch used:\n> > >\n> > > \t@@\n> > > \ttype T;\n> > > \tidentifier f;\n> > > \t@@\n> > > \t- extern\n> > > \t  T f(...);\n> > >\n> > > and it was run with:\n> > >\n> > > \t$ git ls-files compat/\\*\\*.{c,h} |\n> > > \t\txargs spatch --sp-file contrib/coccinelle/noextern.cocci --in-place\n> > > \t$ git checkout -- \\\n> > > \t\tcompat/regex/ \\\n> > > \t\tcompat/inet_ntop.c \\\n> > > \t\tcompat/inet_pton.c \\\n> > > \t\tcompat/nedmalloc/ \\\n> > > \t\tcompat/obstack.{c,h} \\\n> > > \t\tcompat/poll/\n> > >\n> > > Coccinelle has some trouble dealing with `__attribute__` and varargs so\n> > > we ran the following to ensure that no remaining changes were left\n> > > behind:\n> > >\n> > > \t$ git ls-files compat/\\*\\*.{c,h} |\n> > > \t\txargs sed -i'' -e 's/^\\(\\s*\\)extern \\([^(]*([^*]\\)/\\1\\2/'\n> > > \t$ git checkout -- \\\n> > > \t\tcompat/regex/ \\\n> > > \t\tcompat/inet_ntop.c \\\n> > > \t\tcompat/inet_pton.c \\\n> > > \t\tcompat/nedmalloc/ \\\n> > > \t\tcompat/obstack.{c,h} \\\n> > > \t\tcompat/poll/\n> >\n> > I wonder whether we want to make this part of the (slightly misnamed)\n> > \"Static Analysis\" job in our CI.\n>\n> Do you mean running cocci on all of our source files as opposed to just\n> the files we compile? These two patches are part of an experimental (and\n> unsubmitted) patchset that does exactly that. Seeing that there's\n> interest, I'll try to send it in soon.\n\nI look forward to it!\nDscho\n"}]}