[v2,10/16] libasm: stdio_ext.h are not present on win32

Message ID 20221217165213.152-11-luoyonggang@gmail.com
State Dropped
Headers
Series Patches for building with mingw/gcc msvc/clang-cl |

Commit Message

Yonggang Luo Dec. 17, 2022, 4:52 p.m. UTC
  Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
 libasm/asm_begin.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
  

Comments

Mark Wielaard Feb. 23, 2023, 12:35 p.m. UTC | #1
Hi,

On Sun, 2022-12-18 at 00:52 +0800, Yonggang Luo via Elfutils-devel
wrote:
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> ---
>  libasm/asm_begin.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/libasm/asm_begin.c b/libasm/asm_begin.c
> index 9e4dfe43..9b6d974e 100644
> --- a/libasm/asm_begin.c
> +++ b/libasm/asm_begin.c
> @@ -34,10 +34,13 @@
>  #include <assert.h>
>  #include <errno.h>
>  #include <stdio.h>
> -#include <stdio_ext.h>
>  #include <stdlib.h>
>  #include <string.h>
>  
> +#if !defined(_WIN32)
> +#include <stdio_ext.h>
> +#endif
> +

Can we have a configure check instead?

>  #include <gelf.h>
>  #include "libasmP.h"
>  
> @@ -56,8 +59,10 @@ prepare_text_output (AsmCtx_t *result)
>  	  free (result);
>  	  result = NULL;
>  	}
> +#if !defined(_WIN32)
>        else
>  	__fsetlocking (result->out.file, FSETLOCKING_BYCALLER);
> +#endif
>      }
>  
>    return result;

__fsetlocking is used in a lot of other places.

Cheers,

Mark
  

Patch

diff --git a/libasm/asm_begin.c b/libasm/asm_begin.c
index 9e4dfe43..9b6d974e 100644
--- a/libasm/asm_begin.c
+++ b/libasm/asm_begin.c
@@ -34,10 +34,13 @@ 
 #include <assert.h>
 #include <errno.h>
 #include <stdio.h>
-#include <stdio_ext.h>
 #include <stdlib.h>
 #include <string.h>
 
+#if !defined(_WIN32)
+#include <stdio_ext.h>
+#endif
+
 #include <gelf.h>
 #include "libasmP.h"
 
@@ -56,8 +59,10 @@  prepare_text_output (AsmCtx_t *result)
 	  free (result);
 	  result = NULL;
 	}
+#if !defined(_WIN32)
       else
 	__fsetlocking (result->out.file, FSETLOCKING_BYCALLER);
+#endif
     }
 
   return result;