bug-grep
[Top][All Lists]
Advanced

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

Re: grep-2.9.69-f91c on MSVC 9


From: Bruno Haible
Subject: Re: grep-2.9.69-f91c on MSVC 9
Date: Sat, 12 Nov 2011 00:43:21 +0100
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

Jim Meyering wrote:
> > Also, in pcresearch.c the definition of Pexecute does not have the same
> > declspecs as the declaration in search.h:54. A similar fix as for
> > obstack.c should work.
> 
> Can you post a patch?

Actually it's not a terribly good idea to have a 'noreturn' attribute
depend on the configuration. In this case, the function 'Pexecute' is
never called directly, only its function pointer is stored in a
table cell where it will never be fetched.

Here's a proposed patch. I verified that on Linux, it produces no
warning with --disable-perl-regexp --enable-gcc-warnings.


2011-11-11  Bruno Haible  <address@hidden>

        Fix compilation error on MSVC 9 to due Pexecute() declaration.
        * src/pcresearch.c (WITHOUT_PCRE_NORETURN): Remove macro.
        (Pexecute): Replace abort() call with code that does not trigger GCC
        warnings.

--- grep-2.9.69-f91c/src/pcresearch.c   2011-09-15 19:31:04.000000000 +0200
+++ grep-2.9.69-f91c/src/pcresearch.c   2011-11-12 00:28:35.000000000 +0100
@@ -101,19 +101,14 @@
 #endif
 }
 
-/* Pexecute is a no-return function when building --without-pcre.  */
-#if !HAVE_LIBPCRE
-# define WITHOUT_PCRE_NORETURN _Noreturn
-#else
-# define WITHOUT_PCRE_NORETURN /* empty */
-#endif
-
-size_t WITHOUT_PCRE_NORETURN
+size_t
 Pexecute (char const *buf, size_t size, size_t *match_size,
           char const *start_ptr)
 {
 #if !HAVE_LIBPCRE
-  abort ();
+  /* We can't get here, because Pcompile would have been called earlier.  */
+  error (EXIT_TROUBLE, 0, "abort");
+  return -1;
 #else
   /* This array must have at least two elements; everything after that
      is just for performance improvement in pcre_exec.  */
-- 
In memoriam Jan Opletal <http://en.wikipedia.org/wiki/Jan_Opletal>



reply via email to

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