VxWorks' write() takes its second argument as non-const, but the
compiler complains if one tries to pass a const pointer to it.
This simply changes the prototype to say it is const so everything
works.

Changes:

    * fixincludes/inclhack.def:  Added vxworks_write_const fix
    * fixincludes/fixincl.x:  Regenerate
---
 fixincludes/inclhack.def |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

>From e30ed6b06659f1d88fc76ea6fe83408bc6d3060c Mon Sep 17 00:00:00 2001
From: rbmj <r...@verizon.net>
Date: Mon, 4 Jun 2012 14:21:37 -0400
Subject: [PATCH 7/7] Add fix to make write() const correct on VxWorks

VxWorks' write() takes its second argument as non-const, but the
compiler complains if one tries to pass a const pointer to it.
This simply changes the prototype to say it is const so everything
works.

Changes:

	* fixincludes/inclhack.def:  Added vxworks_write_const fix
	* fixincludes/fixincl.x:  Regenerate
---
 fixincludes/inclhack.def |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 7863dbe..063158c 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -4530,6 +4530,23 @@ fix = {
                 "#define VOIDFUNCPTR (void(*)())";
 };
 
+/*
+ *  This hack makes write const-correct on VxWorks
+ */
+fix = {
+	hackname	= vxworks_write_const;
+	files		= ioLib.h;
+	mach		= "*-*-vxworks*";
+
+	c_fix		= format;
+	c_fix_arg	= "extern int  write (int, const char*, size_t);";
+	c_fix_arg	= "extern[\t ]+int[\t ]+write[\t ]*\("
+		"[\t ]*int[\t ]*,"
+		"[\t ]*char[\t ]*\*[\t ]*,"
+		"[\t ]*size_t[\t ]*\)[\t ]*;";
+	
+	test_text	= "extern int write ( int , char * , size_t ) ;";
+};
 
 /*
  *  There are several name conflicts with C++ reserved words in X11 header
-- 
1.7.5.4

Reply via email to