Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
cdbe6c3a
Commit
cdbe6c3a
authored
Oct 19, 2006
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add check for the PyArg_ParseTuple format, and declare
it if it is supported.
parent
e56c5d1c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
96 additions
and
2 deletions
+96
-2
Include/modsupport.h
Include/modsupport.h
+1
-1
Include/pyport.h
Include/pyport.h
+9
-0
Misc/NEWS
Misc/NEWS
+3
-0
configure
configure
+65
-1
configure.in
configure.in
+15
-0
pyconfig.h.in
pyconfig.h.in
+3
-0
No files found.
Include/modsupport.h
View file @
cdbe6c3a
...
...
@@ -24,7 +24,7 @@ PyAPI_FUNC(PyObject *) _Py_VaBuildValue_SizeT(const char *, va_list);
#endif
PyAPI_FUNC
(
int
)
PyArg_Parse
(
PyObject
*
,
const
char
*
,
...);
PyAPI_FUNC
(
int
)
PyArg_ParseTuple
(
PyObject
*
,
const
char
*
,
...);
PyAPI_FUNC
(
int
)
PyArg_ParseTuple
(
PyObject
*
,
const
char
*
,
...)
Py_FORMAT_PARSETUPLE
(
PyArg_ParseTuple
,
2
,
3
)
;
PyAPI_FUNC
(
int
)
PyArg_ParseTupleAndKeywords
(
PyObject
*
,
PyObject
*
,
const
char
*
,
char
**
,
...);
PyAPI_FUNC
(
int
)
PyArg_UnpackTuple
(
PyObject
*
,
const
char
*
,
Py_ssize_t
,
Py_ssize_t
,
...);
...
...
Include/pyport.h
View file @
cdbe6c3a
...
...
@@ -749,6 +749,15 @@ typedef struct fd_set {
#define Py_GCC_ATTRIBUTE(x) __attribute__(x)
#endif
/*
* Add PyArg_ParseTuple format where available.
*/
#ifdef HAVE_ATTRIBUTE_FORMAT_PARSETUPLE
#define Py_FORMAT_PARSETUPLE(func,p1,p2) __attribute__((format(func,p1,p2)))
#else
#define Py_FORMAT_PARSETUPLE(func,p1,p2)
#endif
/* Eliminate end-of-loop code not reached warnings from SunPro C
* when using do{...}while(0) macros
*/
...
...
Misc/NEWS
View file @
cdbe6c3a
...
...
@@ -223,6 +223,9 @@ Tools
Build
-----
-
configure
now
checks
whether
gcc
supports
the
PyArg_ParseTuple
format
attribute
.
-
Bug
#
1578513
:
Cross
compilation
was
broken
by
a
change
to
configure
.
Repair
so
that
it
's back to how it was in 2.4.3.
...
...
configure
View file @
cdbe6c3a
#! /bin/sh
# From configure.in Revision: 52
089
.
# From configure.in Revision: 52
363
.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for python 2.6.
#
...
...
@@ -4036,6 +4036,70 @@ echo "${ECHO_T}$ac_cv_olimit_ok" >&6
fi
fi
# Check whether GCC supports PyArg_ParseTuple format
if
test
"
$GCC
"
=
"yes"
then
echo
"
$as_me
:
$LINENO
: checking whether gcc supports ParseTuple __format__"
>
&5
echo
$ECHO_N
"checking whether gcc supports ParseTuple __format__...
$ECHO_C
"
>
&6
save_CFLAGS
=
$CFLAGS
CFLAGS
=
"
$CFLAGS
-Werror"
cat
>
conftest.
$ac_ext
<<
_ACEOF
/* confdefs.h. */
_ACEOF
cat
confdefs.h
>>
conftest.
$ac_ext
cat
>>
conftest.
$ac_ext
<<
_ACEOF
/* end confdefs.h. */
void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));
int
main ()
{
;
return 0;
}
_ACEOF
rm
-f
conftest.
$ac_objext
if
{
(
eval echo
"
$as_me
:
$LINENO
:
\"
$ac_compile
\"
"
)
>
&5
(
eval
$ac_compile
)
2>conftest.er1
ac_status
=
$?
grep
-v
'^ *+'
conftest.er1
>
conftest.err
rm
-f
conftest.er1
cat
conftest.err
>
&5
echo
"
$as_me
:
$LINENO
:
\$
? =
$ac_status
"
>
&5
(
exit
$ac_status
)
;
}
&&
{
ac_try
=
'test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{
(
eval echo
"
$as_me
:
$LINENO
:
\"
$ac_try
\"
"
)
>
&5
(
eval
$ac_try
)
2>&5
ac_status
=
$?
echo
"
$as_me
:
$LINENO
:
\$
? =
$ac_status
"
>
&5
(
exit
$ac_status
)
;
}
;
}
&&
{
ac_try
=
'test -s conftest.$ac_objext'
{
(
eval echo
"
$as_me
:
$LINENO
:
\"
$ac_try
\"
"
)
>
&5
(
eval
$ac_try
)
2>&5
ac_status
=
$?
echo
"
$as_me
:
$LINENO
:
\$
? =
$ac_status
"
>
&5
(
exit
$ac_status
)
;
}
;
}
;
then
cat
>>
confdefs.h
<<
\
_ACEOF
#define HAVE_ATTRIBUTE_FORMAT_PARSETUPLE 1
_ACEOF
echo
"
$as_me
:
$LINENO
: result: yes"
>
&5
echo
"
${
ECHO_T
}
yes"
>
&6
else
echo
"
$as_me
: failed program was:"
>
&5
sed
's/^/| /'
conftest.
$ac_ext
>
&5
echo
"
$as_me
:
$LINENO
: result: no"
>
&5
echo
"
${
ECHO_T
}
no"
>
&6
fi
rm
-f
conftest.err conftest.
$ac_objext
conftest.
$ac_ext
fi
# On some compilers, pthreads are available without further options
# (e.g. MacOS X). On some of these systems, the compiler will not
# complain if unaccepted options are passed (e.g. gcc on Mac OS X).
...
...
configure.in
View file @
cdbe6c3a
...
...
@@ -890,6 +890,21 @@ else
fi
fi
# Check whether GCC supports PyArg_ParseTuple format
if test "$GCC" = "yes"
then
AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror"
AC_TRY_COMPILE([
void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));
],,
AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1, [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
fi
# On some compilers, pthreads are available without further options
# (e.g. MacOS X). On some of these systems, the compiler will not
# complain if unaccepted options are passed (e.g. gcc on Mac OS X).
...
...
pyconfig.h.in
View file @
cdbe6c3a
...
...
@@ -40,6 +40,9 @@
/* Define to 1 if you have the <asm/types.h> header file. */
#undef HAVE_ASM_TYPES_H
/* Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3))) */
#undef HAVE_ATTRIBUTE_FORMAT_PARSETUPLE
/* Define to 1 if you have the `bind_textdomain_codeset' function. */
#undef HAVE_BIND_TEXTDOMAIN_CODESET
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment