This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 6/7] Add hack for ioctl() on VxWorks.


ioctl() is supposed to be variadic, but VxWorks only has a three
argument version with the third argument of type int.  This messes
up when the third argument is not implicitly convertible to int.
This adds a macro which wraps around ioctl() and explicitly casts
the third argument to an int.

Changes:

    * fixincludes/inclhack.def: Added vxworks_ioctl_macro fix
---
 fixincludes/inclhack.def |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

>From 3a52d77fdbf4c422a1e641402794ce8eda47f410 Mon Sep 17 00:00:00 2001
From: rbmj <rbmj@verizon.net>
Date: Mon, 4 Jun 2012 14:16:26 -0400
Subject: [PATCH 6/7] Add hack for ioctl() on VxWorks.

ioctl() is supposed to be variadic, but VxWorks only has a three
argument version with the third argument of type int.  This messes
up when the third argument is not implicitly convertible to int.
This adds a macro which wraps around ioctl() and explicitly casts
the third argument to an int.

Changes:

	* fixincludes/inclhack.def: Added vxworks_ioctl_macro fix
---
 fixincludes/inclhack.def |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index a258f10..7863dbe 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -4440,6 +4440,22 @@ fix = {
     "#endif /* __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__ */\n";
 };
 
+/*
+ *  Wrap VxWorks ioctl to keep everything pretty
+ */
+fix = {
+	hackname	= vxworks_ioctl_macro;
+	files	   	= ioLib.h;
+	mach		= "*-*-vxworks*";
+
+	c_fix		= format;
+	c_fix_arg	= "%0\n"
+		"#define ioctl(fd, func, arg) ((ioctl)((fd), (func), ((int)(arg))))\n";
+	c_fix_arg	= "extern[\t ]+int[\t ]+ioctl[\t ]*\([\t ,[:alnum:]]\);";
+	
+	test_text	= "extern int ioctl ( int asdf1234, int jkl , int qwerty ) ;";
+};
+
 
 /*
  *  Fix VxWorks <time.h> to not require including <vxTypes.h>.
-- 
1.7.5.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]