diff --git a/renderer-msvc.c b/renderer-msvc.c index e654b1d..6c28e1b 100644 --- a/renderer-msvc.c +++ b/renderer-msvc.c @@ -67,7 +67,7 @@ fragment_len(const pkgconf_fragment_t *frag) static inline bool allowed_fragment(const pkgconf_fragment_t *frag) { - return !(!frag->type || frag->data == NULL || strchr("Ll", frag->type) == NULL); + return !(!frag->type || frag->data == NULL || strchr("DILl", frag->type) == NULL); } static size_t @@ -123,11 +123,17 @@ msvc_renderer_render_buf(const pkgconf_list_t *list, char *buf, size_t buflen, b if (fragment_len(frag) > buf_remaining) break; - if (frag->type == 'L') - { - size_t cnt = pkgconf_strlcpy(bptr, "/libpath:", buf_remaining); + switch(frag->type) { + case 'D': + case 'I': + *bptr++ = '/'; + *bptr++ = frag->type; + break; + case 'L': + cnt = pkgconf_strlcpy(bptr, "/libpath:", buf_remaining); bptr += cnt; buf_remaining -= cnt; + break; } escape = fragment_should_quote(frag); @@ -141,7 +147,7 @@ msvc_renderer_render_buf(const pkgconf_list_t *list, char *buf, size_t buflen, b if (frag->type == 'l') { - size_t cnt = pkgconf_strlcpy(bptr, ".lib", buf_remaining); + cnt = pkgconf_strlcpy(bptr, ".lib", buf_remaining); bptr += cnt; buf_remaining -= cnt; } diff --git a/tests/parser.sh b/tests/parser.sh index 2677658..209000b 100755 --- a/tests/parser.sh +++ b/tests/parser.sh @@ -28,7 +28,8 @@ tests_init \ fragment_quoting_3 \ fragment_quoting_5 \ fragment_quoting_7 \ - msvc_fragment_quoting + msvc_fragment_quoting \ + msvc_fragment_render_cflags comments_body() { @@ -257,3 +258,11 @@ msvc_fragment_quoting_body() -o inline:'/libpath:"C:\D E" E.lib \n' \ pkgconf --libs --msvc-syntax fragment-escaping-1 } + +msvc_fragment_render_cflags_body() +{ + export PKG_CONFIG_PATH="${selfdir}/lib1" + atf_check \ + -o inline:'/I/test/include/foo /DFOO_STATIC \n' \ + pkgconf --cflags --static --msvc-syntax foo +}