Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
7436f435
Commit
7436f435
authored
Sep 15, 1992
by
Richard Stallman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(va_arg): Cast ptr to void *, then to TYPE *.
From-SVN: r2124
parent
347099d6
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
18 deletions
+31
-18
gcc/ginclude/stdarg.h
+3
-1
gcc/ginclude/va-i960.h
+3
-1
gcc/ginclude/va-m88k.h
+9
-6
gcc/ginclude/va-mips.h
+7
-5
gcc/ginclude/va-pa.h
+2
-2
gcc/ginclude/va-pyr.h
+3
-1
gcc/ginclude/va-sparc.h
+4
-2
No files found.
gcc/ginclude/stdarg.h
View file @
7436f435
...
...
@@ -62,9 +62,11 @@ typedef void *__gnuc_va_list;
void
va_end
(
__gnuc_va_list
);
/* Defined in libgcc.a */
#define va_end(AP)
/* We cast to void * and then to TYPE * because this avoids
a warning about increasing the alignment requirement. */
#define va_arg(AP, TYPE) \
(AP = (char *) (AP) + __va_rounded_size (TYPE), \
*((TYPE *) ((char *) (AP) - __va_rounded_size (TYPE))))
*((TYPE *) (
void *) (
(char *) (AP) - __va_rounded_size (TYPE))))
#endif
/* _STDARG_H */
#endif
/* not alpha */
...
...
gcc/ginclude/va-i960.h
View file @
7436f435
...
...
@@ -40,6 +40,8 @@ typedef unsigned __gnuc_va_list[2];
#define va_start(AP) ((AP)[1] = 0, *(AP) = (unsigned) &va_alist)
#endif
/* We cast to void * and then to TYPE * because this avoids
a warning about increasing the alignment requirement. */
#define va_arg(AP, T) \
( \
( \
...
...
@@ -48,7 +50,7 @@ typedef unsigned __gnuc_va_list[2];
: ((AP)[1] = __vpad ((AP)[1], T)) \
), \
\
*((T *) (
(char *) *(AP) + (AP)[1] - __vsiz (T)))
\
*((T *) (
void *) ((char *) *(AP) + (AP)[1] - __vsiz (T)))
\
)
void
va_end
(
__gnuc_va_list
);
/* Defined in libgcc.a */
...
...
gcc/ginclude/va-m88k.h
View file @
7436f435
...
...
@@ -63,13 +63,16 @@ typedef struct
#define __va_size(TYPE) ((sizeof(TYPE) + 3) >> 2)
#define va_arg(AP,TYPE) \
/* We cast to void * and then to TYPE * because this avoids
a warning about increasing the alignment requirement. */
#define va_arg(AP,TYPE) \
( (AP).__va_arg = (((AP).__va_arg + (1 << (__alignof__(TYPE) >> 3)) - 1) \
& ~((1 << (__alignof__(TYPE) >> 3)) - 1)) \
+ __va_size(TYPE), \
*((TYPE *) ((__va_reg_p(TYPE) && (AP).__va_arg < 8 + __va_size(TYPE) \
? (AP).__va_reg : (AP).__va_stk) \
+ ((AP).__va_arg - __va_size(TYPE)))))
& ~((1 << (__alignof__(TYPE) >> 3)) - 1)) \
+ __va_size(TYPE), \
*((TYPE *) (void *) ((__va_reg_p(TYPE) \
&& (AP).__va_arg < 8 + __va_size(TYPE) \
? (AP).__va_reg : (AP).__va_stk) \
+ ((AP).__va_arg - __va_size(TYPE)))))
#define va_end(AP)
...
...
gcc/ginclude/va-mips.h
View file @
7436f435
...
...
@@ -49,11 +49,13 @@ void va_end (__gnuc_va_list); /* Defined in libgcc.a */
#define va_arg(list, mode) ((mode *)(list += __va_rounded_size(mode)))[-1]
#else
/* !lint */
#define va_arg(__AP, __type) \
((__type *)(__AP = (char *) ((__alignof(__type) > 4 \
? ((int)__AP + 8 - 1) & -8 \
: ((int)__AP + 4 - 1) & -4) \
+ __va_rounded_size(__type))))[-1]
/* We cast to void * and then to TYPE * because this avoids
a warning about increasing the alignment requirement. */
#define va_arg(__AP, __type) \
((__type *) (void *) (__AP = (char *) ((__alignof(__type) > 4 \
? ((int)__AP + 8 - 1) & -8 \
: ((int)__AP + 4 - 1) & -4) \
+ __va_rounded_size(__type))))[-1]
#endif
/* lint */
#endif
/* defined (_STDARG_H) || defined (_VARARGS_H) */
gcc/ginclude/va-pa.h
View file @
7436f435
...
...
@@ -22,11 +22,11 @@ typedef double *__gnuc_va_list;
#define va_arg(AP,TYPE) \
(sizeof(TYPE) > 8 ? \
((AP = (__gnuc_va_list) ((char *)AP - sizeof (int))), \
(*((TYPE *) (
*((int *) (AP))))))
\
(*((TYPE *) (
void *) (*((int *) (AP))))))
\
:((AP = \
(__gnuc_va_list) ((long)((char *)AP - sizeof (TYPE)) \
& (sizeof(TYPE) > 4 ? ~0x7 : ~0x3))), \
(*((TYPE *) ((char *)AP + ((8 - sizeof(TYPE)) % 4))))))
(*((TYPE *) (
void *) (
(char *)AP + ((8 - sizeof(TYPE)) % 4))))))
#define va_end(AP)
...
...
gcc/ginclude/va-pyr.h
View file @
7436f435
...
...
@@ -107,6 +107,8 @@ typedef __va_buf __gnuc_va_list;
#define __extension__
#endif
/* We cast to void * and then to TYPE * because this avoids
a warning about increasing the alignment requirement. */
#define va_arg(_AP, _MODE) \
__extension__ \
({__voidptr *__ap = (__voidptr*)&_AP; \
...
...
@@ -119,7 +121,7 @@ __extension__ \
((void *)__ap[__onstack])+=__size; \
if (__onstack==0 || (int)(__ap[2])==11) \
__ap[2]+= (__size >> 2); \
*(( _MODE *)
__param_addr);
\
*(( _MODE *)
(void *) __param_addr);
\
})
void
va_end
(
__gnuc_va_list
);
/* Defined in libgcc.a */
...
...
gcc/ginclude/va-sparc.h
View file @
7436f435
...
...
@@ -59,6 +59,8 @@ void va_end (__gnuc_va_list); /* Defined in libgcc.a */
not word-aligned, we advance the pointer to the first non-reg slot. */
/* We don't declare the union member `d' to have type TYPE
because that would lose in C++ if TYPE has a constructor. */
/* We cast to void * and then to TYPE * because this avoids
a warning about increasing the alignment requirement. */
#define va_arg(pvar,TYPE) \
__extension__ \
({ TYPE __va_temp; \
...
...
@@ -70,9 +72,9 @@ __extension__ \
__u.__i[0] = ((int *) (pvar))[0]; \
__u.__i[1] = ((int *) (pvar))[1]; \
(pvar) += 8; \
*(TYPE *)
__u.__d; })
\
*(TYPE *)
(void *) __u.__d; })
\
: ((pvar) += __va_rounded_size (TYPE), \
*((TYPE *) ((pvar) - __va_rounded_size (TYPE)))));})
*((TYPE *) (
void *) (
(pvar) - __va_rounded_size (TYPE)))));})
#endif
/* defined (_STDARG_H) || defined (_VARARGS_H) */
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