[Open-FCoE] [PATCH] libhbalinux: Fix build warnings

Fastabend, John R john.r.fastabend at intel.com
Tue Jul 7 00:20:03 UTC 2009


Steve, this should be _GNU_SOURCE instead of __USE_GNU.  __USE_GNU should only be used as an internal macro for glibc.  Review features.h.

Additionally you _must_ define the _GNU_SOURCE macro before including headers.  See the quote below from the glibc manual, 

"You should define these macros by using '#define' preprocessor directives at the top of your source code files. These directives must come before any #include of a system header file. It is best to make them the very first thing in the file, preceded only by comments. You could also use the '-D' option to GCC, but it's better if you make the source files indicate their own meaning in a self-contained way."

Thanks,
John.


-----Original Message-----
From: devel-bounces at open-fcoe.org [mailto:devel-bounces at open-fcoe.org] On Behalf Of Robert Love
Sent: Monday, July 06, 2009 12:19 PM
To: Ma, Steve
Cc: devel at open-fcoe.org
Subject: Re: [Open-FCoE] [PATCH] libhbalinux: Fix build warnings

On Wed, 2009-07-01 at 16:30 -0700, Steve Ma wrote:
> Fix a build warning of strnlen, and
> removed an unused variable.
> 
Steve, what is the warning that you're fixing and how does this patch
accomplish it? Can you please update this commit message with that
information?

I see that you're adding __USE_GNU, but I don't know why...

> Signed-off-by: Steve Ma <steve.ma at intel.com>
> ---
> 
>  pci.c   |    1 -
>  utils.h |    1 +
>  2 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/pci.c b/pci.c
> index ee53c3d..82879bf 100644
> --- a/pci.c
> +++ b/pci.c
> @@ -152,7 +152,6 @@ static void
>  get_pci_device_info(struct pci_device *dev, struct hba_info *hba_info)
>  {
>  	const char *name;
> -	u_int16_t class;
>  	u_int8_t revision;
>  	u_int8_t hdr_type;
>  	char *unknown = "Unknown";
> diff --git a/utils.h b/utils.h
> index 13109e2..2061737 100644
> --- a/utils.h
> +++ b/utils.h
> @@ -31,6 +31,7 @@
>  #include <errno.h>
>  #include <unistd.h>
>  #include <dirent.h>
> +#define __USE_GNU
>  #include <string.h>
>  #include <time.h>
>  #include <fcntl.h>
> 
> _______________________________________________
> devel mailing list
> devel at open-fcoe.org
> http://www.open-fcoe.org/mailman/listinfo/devel

_______________________________________________
devel mailing list
devel at open-fcoe.org
http://www.open-fcoe.org/mailman/listinfo/devel



More information about the devel mailing list