pkgsrc-Bugs archive

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

pkg/32155: devel/pcre fails to build on Solaris 10 with Sun Studio 11 compilers



>Number:         32155
>Category:       pkg
>Synopsis:       devel/pcre fails to build on Solaris 10 with Sun Studio 11 
>compilers
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 24 10:22:00 +0000 2005
>Originator:     segv
>Release:        
>Organization:
>Environment:
SunOS ultra10 5.10 Generic sun4u sparc SUNW,Ultra-5_10
>Description:
Building pcre with Sun Studio 11 compilers produces the following error:

"./pcre_scanner.cc", line 93: Error: Could not find a match for 
std::count<std::InputIterator, std::T, std::Size>(const char*, const char*, 
char) needed in pcrecpp::Scanner::LineNumber() const. 1 Error(s) detected. ***
Error code 1

>How-To-Repeat:

>Fix:
I emailed the author about the problem and he got back to me with the following 
patch, which fixes the problem:

diff -Nur pcre-6.4/pcre_scanner.cc pcre-6.4-new/pcre_scanner.cc
--- pcre-6.4/pcre_scanner.cc    2005-09-12 01:45:39.000000000 -0700
+++ pcre-6.4-new/pcre_scanner.cc        2005-11-23 14:13:48.000000000
-0800
@@ -30,7 +30,6 @@
 // Author: Sanjay Ghemawat

 #include <vector>
-#include <algorithm>     // for count()
 #include <assert.h>
 #include "config.h"
 #include "pcre_scanner.h"
@@ -90,7 +89,12 @@
 int Scanner::LineNumber() const {
   // TODO: Make it more efficient by keeping track of the last point
   // where we computed line numbers and counting newlines since then.
-  return 1 + std::count(data_.data(), input_.data(), '\n');
+  // We could use std:count, but not all systems have it (HPUX). :-(
+  int count = 1;
+  for (const char* p = data_.data(); p < input_.data(); ++p)
+    if (*p == '\n')
+      ++count;
+  return count;
 }

 int Scanner::Offset() const {
diff -Nur pcre-6.4/pcre_scanner_unittest.cc
pcre-6.4-new/pcre_scanner_unittest.cc
--- pcre-6.4/pcre_scanner_unittest.cc   2005-09-12 01:45:39.000000000
-0700
+++ pcre-6.4-new/pcre_scanner_unittest.cc       2005-11-23
14:14:10.000000000 -0800
@@ -68,6 +68,7 @@
   s.Consume(re, &var, &number);
   CHECK_EQ(var, "alpha");
   CHECK_EQ(number, 1);
+  CHECK_EQ(s.LineNumber(), 3);
   s.GetNextComments(&comments);
   CHECK_EQ(comments.size(), 1);
   CHECK_EQ(comments[0].as_string(), " // this sets alpha\n");





Home | Main Index | Thread Index | Old Index