Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] jsoncpp: fix build
@ 2015-03-24 16:22 Baruch Siach
  2015-03-24 23:47 ` Thomas Petazzoni
  0 siblings, 1 reply; 3+ messages in thread
From: Baruch Siach @ 2015-03-24 16:22 UTC (permalink / raw)
  To: buildroot

Add a patch removing reference to non-existent std::snprintf.

Fixes:
http://autobuild.buildroot.net/results/b39/b390beeb9a6fea12f1a4d9f2ff9a8a483628cad2/
http://autobuild.buildroot.net/results/d18/d18b3e116b680a3897fbea296938e900a1e5e80a/
http://autobuild.buildroot.net/results/1b2/1b20a2f81dd2b409785930705222bc03576c4907/

and many more.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 ...001-Revert-Use-std-namespace-for-snprintf.patch | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 package/jsoncpp/0001-Revert-Use-std-namespace-for-snprintf.patch

diff --git a/package/jsoncpp/0001-Revert-Use-std-namespace-for-snprintf.patch b/package/jsoncpp/0001-Revert-Use-std-namespace-for-snprintf.patch
new file mode 100644
index 000000000000..1ffba9e3acfc
--- /dev/null
+++ b/package/jsoncpp/0001-Revert-Use-std-namespace-for-snprintf.patch
@@ -0,0 +1,34 @@
+From ce9b8553fe6741a935079ce94f8b29a26af1887f Mon Sep 17 00:00:00 2001
+From: Baruch Siach <baruch@tkos.co.il>
+Subject: [PATCH] Revert "Use std namespace for snprintf."
+
+This reverts commit 1c58876185d2a4ed87dac4a54b82f607e74f55fd.
+
+snprintf() is not in the std namespace. This fixes the build error below:
+
+src/lib_json/json_writer.cpp:33:18: error: 'snprintf' is not a member of 'std'
+
+Upstream status: sent upstream
+https://github.com/open-source-parsers/jsoncpp/pull/227
+
+Signed-off-by: Baruch Siach <baruch@tkos.co.il>
+---
+ src/lib_json/json_writer.cpp | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp
+index 83102fd2bb86..f7ad1e21bbc0 100644
+--- a/src/lib_json/json_writer.cpp
++++ b/src/lib_json/json_writer.cpp
+@@ -29,8 +29,6 @@
+ 
+ #if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below
+ #define snprintf _snprintf
+-#else
+-#define snprintf std::snprintf
+ #endif
+ 
+ #if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0
+-- 
+2.1.4
+
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] jsoncpp: fix build
  2015-03-24 16:22 [Buildroot] [PATCH] jsoncpp: fix build Baruch Siach
@ 2015-03-24 23:47 ` Thomas Petazzoni
  2015-03-26  4:57   ` Baruch Siach
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni @ 2015-03-24 23:47 UTC (permalink / raw)
  To: buildroot

Dear Baruch Siach,

On Tue, 24 Mar 2015 18:22:51 +0200, Baruch Siach wrote:

> +snprintf() is not in the std namespace. This fixes the build error below:
> +
> +src/lib_json/json_writer.cpp:33:18: error: 'snprintf' is not a member of 'std'

Well, in C++11, snprintf *is* in the std:: namespace. See
http://en.cppreference.com/w/cpp/io/c/fprintf. However, if we can get
along without using std::snprintf() and use the C library snprintf()
instead as a work-around in Buildroot, then it's all great for me.

But it would require a reworking of your patch, along the lines of:

std::snprintf() is only available in C++11, which is not provided by
all compilers. Since the C library snprintf() can easily be used as a
replacement on Linux systems, this patch changes jsoncpp to use the C
library snprintf() instead of C++11 std::snprintf().

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] jsoncpp: fix build
  2015-03-24 23:47 ` Thomas Petazzoni
@ 2015-03-26  4:57   ` Baruch Siach
  0 siblings, 0 replies; 3+ messages in thread
From: Baruch Siach @ 2015-03-26  4:57 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

On Wed, Mar 25, 2015 at 12:47:03AM +0100, Thomas Petazzoni wrote:
> On Tue, 24 Mar 2015 18:22:51 +0200, Baruch Siach wrote:
> > +snprintf() is not in the std namespace. This fixes the build error below:
> > +
> > +src/lib_json/json_writer.cpp:33:18: error: 'snprintf' is not a member of 'std'
> 
> Well, in C++11, snprintf *is* in the std:: namespace. See
> http://en.cppreference.com/w/cpp/io/c/fprintf. However, if we can get
> along without using std::snprintf() and use the C library snprintf()
> instead as a work-around in Buildroot, then it's all great for me.
> 
> But it would require a reworking of your patch, along the lines of:
> 
> std::snprintf() is only available in C++11, which is not provided by
> all compilers. Since the C library snprintf() can easily be used as a
> replacement on Linux systems, this patch changes jsoncpp to use the C
> library snprintf() instead of C++11 std::snprintf().

Thanks for the hint. I'll send an updated pull request, and update this patch.

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-26  4:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-24 16:22 [Buildroot] [PATCH] jsoncpp: fix build Baruch Siach
2015-03-24 23:47 ` Thomas Petazzoni
2015-03-26  4:57   ` Baruch Siach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox