bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] [PATCH] Windows compilation error: #define concatenation


From: Jannick
Subject: Re: [bug-gawk] [PATCH] Windows compilation error: #define concatenation in 'io.c'
Date: Sat, 2 Jan 2016 19:00:14 +0100

-----Original Message-----
From: Eli Zaretskii [mailto:address@hidden 
Sent: Saturday, January 2, 2016 3:18 PM

> A tiny patch for your consideration avoiding a compilation error on 
> Windows (concatenation in #define statement). The proposed solution 
> might not be the most elegant way, but it works here.

Please show the error message.  This part is in the 4.1.3 sources, and I
didn't have any errors when I built Gawk 4.1.3 on MS-Windows.

(Also, there's nothing Windows-specific in that cpp directive.)

====================

Hi Eli,
Hi Arnold,

My reading of the error message below is that the token 'dll' (defined by
SHLIBEXT) is not enclosed in double quotes.

I hope these are the information you are looking for:
 
- working on Win10
- compiler mingw32-gcc.exe (tdm-1) 4.7.1
- compile and error:
mingw32-gcc.exe -O2 -Wall -gdwarf-2 -g3 -D__USE_MINGW_ANSI_STDIO
-DSHLIBEXT=dll -DHAVE_CONFIG_H -DGAWK -DDYNAMIC -g -Wshadow -Winit-self
-Wredundant-decls -Wunreachable-code -Wmissing-declarations
-Wmissing-include-dirs -pedantic -Wzero-as-null-pointer-constant
-Wfatal-errors -Wextra -Wall -g -IC:\myDevel\svn\svnGAWKsavannah -c
C:\myDevel\svn\svnGAWKsavannah\io.c -o obj\Debug\io.o
[...]
io.c:2823:23: error: expected ')' before 'dll'

- io.c snip:
[...]
#if 0
#define PREPEND_DOT(x) VALUE_TO_STRING(.x)
#define VALUE_TO_STRING(x) #x
#define EXTLIB_SUFFIX   PREPEND_DOT(SHLIBEXT)
#else
#define EXTLIB_SUFFIX   "." SHLIBEXT
#endif
                src_len = strlen(src);
                suffix_len = strlen(EXTLIB_SUFFIX); /// !!! <<< line # 2823

                /* check if already has the SUFFIX */
                if (src_len >= suffix_len && strcmp(& src[src_len -
suffix_len], EXTLIB_SUFFIX) == 0)
                        return NULL;

                /* append EXTLIB_SUFFIX and try again */
                save_errno = errno;
                emalloc(file_ext, char *, src_len + suffix_len + 1,
"find_source");
                sprintf(file_ext, "%s%s", src, EXTLIB_SUFFIX);
                path = do_find_source(file_ext, stb, errcode, pi);
                efree(file_ext);
                if (path == NULL)
                        errno = save_errno;
                return path;
#undef EXTLIB_SUFFIX
#if 0
#undef VALUE_TO_STRING
#undef PREPEND_DOT
#endif // 0
[...]

- same compilation as above with additional '-E' switch yields: 
suffix_len = strlen("." dll);
If the token 'dll' was enclosed in double quotes, everything would be just
fine. This is what I wanted to achieve with the tiny patch (without changing
anything else). 

BTWs: I am not sure how to use the html indentation (to trace authors in a
thread), since the email arrives in flat text format. Sorry about that.

Many thanks,
J.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]