Fix C99ism in vswap()
[tinycc.git] / tcc.c
blobf4d94be70e1161d90b770f8a2d1daee15aa29047
1 /*
2 * TCC - Tiny C Compiler
3 *
4 * Copyright (c) 2001-2004 Fabrice Bellard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifdef ONE_SOURCE
22 #include "libtcc.c"
23 #else
24 #include "tcc.h"
25 #endif
27 static char **files;
28 static int nb_files, nb_libraries;
29 static int multiple_files;
30 static int print_search_dirs;
31 static int output_type;
32 static int reloc_output;
33 static char *outfile;
34 static int do_bench = 0;
35 static int gen_deps;
36 static const char *deps_outfile;
37 static const char *m_option;
38 static CString linker_arg;
40 #define TCC_OPTION_HAS_ARG 0x0001
41 #define TCC_OPTION_NOSEP 0x0002 /* cannot have space before option and arg */
43 static void help(void)
45 printf("tcc version " TCC_VERSION " - Tiny C Compiler - Copyright (C) 2001-2006 Fabrice Bellard\n"
46 "Usage: tcc [options...] [-o outfile] [-c] infile(s)...\n"
47 " tcc [options...] -run infile [arguments...]\n"
48 "General options:\n"
49 " -v display current version, increase verbosity\n"
50 " -c compile only - generate an object file\n"
51 " -o outfile set output filename\n"
52 " -Bdir set tcc internal library and include path\n"
53 " -bench output compilation statistics\n"
54 " -run run compiled source\n"
55 " -fflag set or reset (with 'no-' prefix) 'flag' (see man page)\n"
56 " -Wwarning set or reset (with 'no-' prefix) 'warning' (see man page)\n"
57 " -w disable all warnings\n"
58 "Preprocessor options:\n"
59 " -E preprocess only\n"
60 " -Idir add include path 'dir'\n"
61 " -Dsym[=val] define 'sym' with value 'val'\n"
62 " -Usym undefine 'sym'\n"
63 "Linker options:\n"
64 " -Ldir add library path 'dir'\n"
65 " -llib link with dynamic or static library 'lib'\n"
66 " -pthread link with -lpthread and -D_REENTRANT (POSIX Linux)\n"
67 " -shared generate a shared library\n"
68 " -soname set name for shared library to be used at runtime\n"
69 " -static static linking\n"
70 " -rdynamic export all global symbols to dynamic linker\n"
71 " -r generate (relocatable) object file\n"
72 "Debugger options:\n"
73 " -g generate runtime debug info\n"
74 #ifdef CONFIG_TCC_BCHECK
75 " -b compile with built-in memory and bounds checker (implies -g)\n"
76 #endif
77 #ifdef CONFIG_TCC_BACKTRACE
78 " -bt N show N callers in stack traces\n"
79 #endif
80 "Misc options:\n"
81 " -MD generate target dependencies for make\n"
82 " -MF depfile put generated dependencies here\n"
86 typedef struct TCCOption {
87 const char *name;
88 uint16_t index;
89 uint16_t flags;
90 } TCCOption;
92 enum {
93 TCC_OPTION_HELP,
94 TCC_OPTION_I,
95 TCC_OPTION_D,
96 TCC_OPTION_U,
97 TCC_OPTION_L,
98 TCC_OPTION_B,
99 TCC_OPTION_l,
100 TCC_OPTION_bench,
101 TCC_OPTION_bt,
102 TCC_OPTION_b,
103 TCC_OPTION_g,
104 TCC_OPTION_c,
105 TCC_OPTION_static,
106 TCC_OPTION_shared,
107 TCC_OPTION_soname,
108 TCC_OPTION_o,
109 TCC_OPTION_r,
110 TCC_OPTION_s,
111 TCC_OPTION_Wl,
112 TCC_OPTION_W,
113 TCC_OPTION_O,
114 TCC_OPTION_m,
115 TCC_OPTION_f,
116 TCC_OPTION_isystem,
117 TCC_OPTION_nostdinc,
118 TCC_OPTION_nostdlib,
119 TCC_OPTION_print_search_dirs,
120 TCC_OPTION_rdynamic,
121 TCC_OPTION_pedantic,
122 TCC_OPTION_pthread,
123 TCC_OPTION_run,
124 TCC_OPTION_v,
125 TCC_OPTION_w,
126 TCC_OPTION_pipe,
127 TCC_OPTION_E,
128 TCC_OPTION_MD,
129 TCC_OPTION_MF,
130 TCC_OPTION_x,
133 static const TCCOption tcc_options[] = {
134 { "h", TCC_OPTION_HELP, 0 },
135 { "-help", TCC_OPTION_HELP, 0 },
136 { "?", TCC_OPTION_HELP, 0 },
137 { "I", TCC_OPTION_I, TCC_OPTION_HAS_ARG },
138 { "D", TCC_OPTION_D, TCC_OPTION_HAS_ARG },
139 { "U", TCC_OPTION_U, TCC_OPTION_HAS_ARG },
140 { "L", TCC_OPTION_L, TCC_OPTION_HAS_ARG },
141 { "B", TCC_OPTION_B, TCC_OPTION_HAS_ARG },
142 { "l", TCC_OPTION_l, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
143 { "bench", TCC_OPTION_bench, 0 },
144 #ifdef CONFIG_TCC_BACKTRACE
145 { "bt", TCC_OPTION_bt, TCC_OPTION_HAS_ARG },
146 #endif
147 #ifdef CONFIG_TCC_BCHECK
148 { "b", TCC_OPTION_b, 0 },
149 #endif
150 { "g", TCC_OPTION_g, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
151 { "c", TCC_OPTION_c, 0 },
152 { "static", TCC_OPTION_static, 0 },
153 { "shared", TCC_OPTION_shared, 0 },
154 { "soname", TCC_OPTION_soname, TCC_OPTION_HAS_ARG },
155 { "o", TCC_OPTION_o, TCC_OPTION_HAS_ARG },
156 { "pedantic", TCC_OPTION_pedantic, 0},
157 { "pthread", TCC_OPTION_pthread, 0},
158 { "run", TCC_OPTION_run, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
159 { "rdynamic", TCC_OPTION_rdynamic, 0 },
160 { "r", TCC_OPTION_r, 0 },
161 { "s", TCC_OPTION_s, 0 },
162 { "Wl,", TCC_OPTION_Wl, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
163 { "W", TCC_OPTION_W, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
164 { "O", TCC_OPTION_O, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
165 { "m", TCC_OPTION_m, TCC_OPTION_HAS_ARG },
166 { "f", TCC_OPTION_f, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
167 { "isystem", TCC_OPTION_isystem, TCC_OPTION_HAS_ARG },
168 { "nostdinc", TCC_OPTION_nostdinc, 0 },
169 { "nostdlib", TCC_OPTION_nostdlib, 0 },
170 { "print-search-dirs", TCC_OPTION_print_search_dirs, 0 },
171 { "v", TCC_OPTION_v, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
172 { "w", TCC_OPTION_w, 0 },
173 { "pipe", TCC_OPTION_pipe, 0},
174 { "E", TCC_OPTION_E, 0},
175 { "MD", TCC_OPTION_MD, 0},
176 { "MF", TCC_OPTION_MF, TCC_OPTION_HAS_ARG },
177 { "x", TCC_OPTION_x, TCC_OPTION_HAS_ARG },
178 { NULL },
181 static int64_t getclock_us(void)
183 #ifdef _WIN32
184 struct _timeb tb;
185 _ftime(&tb);
186 return (tb.time * 1000LL + tb.millitm) * 1000LL;
187 #else
188 struct timeval tv;
189 gettimeofday(&tv, NULL);
190 return tv.tv_sec * 1000000LL + tv.tv_usec;
191 #endif
194 /* convert 'str' into an array of space separated strings */
195 static int expand_args(char ***pargv, const char *str)
197 const char *s1;
198 char **argv, *arg;
199 int argc, len;
201 argc = 0;
202 argv = NULL;
203 for(;;) {
204 while (is_space(*str))
205 str++;
206 if (*str == '\0')
207 break;
208 s1 = str;
209 while (*str != '\0' && !is_space(*str))
210 str++;
211 len = str - s1;
212 arg = tcc_malloc(len + 1);
213 memcpy(arg, s1, len);
214 arg[len] = '\0';
215 dynarray_add((void ***)&argv, &argc, arg);
217 *pargv = argv;
218 return argc;
221 /* re-execute the i386/x86_64 cross-compilers with tcc -m32/-m64: */
222 #if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64
223 #ifdef _WIN32
224 #include <process.h>
225 static int execvp_win32(const char *prog, char **argv)
227 int ret = spawnvp(P_NOWAIT, prog, (char const*const*)argv);
228 if (-1 == ret)
229 return ret;
230 cwait(&ret, ret, WAIT_CHILD);
231 exit(ret);
233 #define execvp execvp_win32
234 #endif
235 static void exec_other_tcc(TCCState *s, char **argv, const char *optarg)
237 char child_path[4096], *child_name; const char *target;
238 switch (atoi(optarg)) {
239 #ifdef TCC_TARGET_I386
240 case 32: break;
241 case 64: target = "x86_64";
242 #else
243 case 64: break;
244 case 32: target = "i386";
245 #endif
246 pstrcpy(child_path, sizeof child_path - 40, argv[0]);
247 child_name = tcc_basename(child_path);
248 strcpy(child_name, target);
249 #ifdef TCC_TARGET_PE
250 strcat(child_name, "-win32");
251 #endif
252 strcat(child_name, "-tcc");
253 if (strcmp(argv[0], child_path)) {
254 if (s->verbose > 0)
255 printf("tcc: using '%s'\n", child_name), fflush(stdout);
256 execvp(argv[0] = child_path, argv);
258 tcc_error("'%s' not found", child_name);
259 case 0: /* ignore -march etc. */
260 break;
261 default:
262 tcc_warning("unsupported option \"-m%s\"", optarg);
265 #endif
267 static void parse_option_D(TCCState *s1, const char *optarg)
269 char *sym = tcc_strdup(optarg);
270 char *value = strchr(sym, '=');
271 if (value)
272 *value++ = '\0';
273 tcc_define_symbol(s1, sym, value);
274 tcc_free(sym);
277 static int parse_args(TCCState *s, int argc, char **argv)
279 int optind;
280 const TCCOption *popt;
281 const char *optarg, *p1, *r1;
282 char *r;
283 int was_pthread;
285 was_pthread = 0; /* is set if commandline contains -pthread key */
286 optind = 0;
287 cstr_new(&linker_arg);
289 while (optind < argc) {
291 r = argv[optind++];
292 if (r[0] != '-' || r[1] == '\0') {
293 /* add a new file */
294 dynarray_add((void ***)&files, &nb_files, r);
295 if (!multiple_files) {
296 optind--;
297 /* argv[0] will be this file */
298 break;
300 } else {
301 /* find option in table (match only the first chars */
302 popt = tcc_options;
303 for(;;) {
304 p1 = popt->name;
305 if (p1 == NULL)
306 tcc_error("invalid option -- '%s'", r);
307 r1 = r + 1;
308 for(;;) {
309 if (*p1 == '\0')
310 goto option_found;
311 if (*r1 != *p1)
312 break;
313 p1++;
314 r1++;
316 popt++;
318 option_found:
319 if (popt->flags & TCC_OPTION_HAS_ARG) {
320 if (*r1 != '\0' || (popt->flags & TCC_OPTION_NOSEP)) {
321 optarg = r1;
322 } else {
323 if (optind >= argc)
324 tcc_error("argument to '%s' is missing", r);
325 optarg = argv[optind++];
327 } else {
328 if (*r1 != '\0')
329 return 0;
330 optarg = NULL;
333 switch(popt->index) {
334 case TCC_OPTION_HELP:
335 return 0;
337 case TCC_OPTION_I:
338 if (tcc_add_include_path(s, optarg) < 0)
339 tcc_error("too many include paths");
340 break;
341 case TCC_OPTION_D:
342 parse_option_D(s, optarg);
343 break;
344 case TCC_OPTION_U:
345 tcc_undefine_symbol(s, optarg);
346 break;
347 case TCC_OPTION_L:
348 tcc_add_library_path(s, optarg);
349 break;
350 case TCC_OPTION_B:
351 /* set tcc utilities path (mainly for tcc development) */
352 tcc_set_lib_path(s, optarg);
353 break;
354 case TCC_OPTION_l:
355 dynarray_add((void ***)&files, &nb_files, r);
356 nb_libraries++;
357 break;
358 case TCC_OPTION_pthread:
359 was_pthread = 1;
360 parse_option_D(s, "_REENTRANT");
361 break;
362 case TCC_OPTION_bench:
363 do_bench = 1;
364 break;
365 #ifdef CONFIG_TCC_BACKTRACE
366 case TCC_OPTION_bt:
367 tcc_set_num_callers(atoi(optarg));
368 break;
369 #endif
370 #ifdef CONFIG_TCC_BCHECK
371 case TCC_OPTION_b:
372 s->do_bounds_check = 1;
373 s->do_debug = 1;
374 break;
375 #endif
376 case TCC_OPTION_g:
377 s->do_debug = 1;
378 break;
379 case TCC_OPTION_c:
380 multiple_files = 1;
381 output_type = TCC_OUTPUT_OBJ;
382 break;
383 case TCC_OPTION_static:
384 s->static_link = 1;
385 break;
386 case TCC_OPTION_shared:
387 output_type = TCC_OUTPUT_DLL;
388 break;
389 case TCC_OPTION_soname:
390 s->soname = optarg;
391 break;
392 case TCC_OPTION_m:
393 m_option = optarg;
394 break;
395 case TCC_OPTION_o:
396 multiple_files = 1;
397 outfile = tcc_strdup(optarg);
398 break;
399 case TCC_OPTION_r:
400 /* generate a .o merging several output files */
401 reloc_output = 1;
402 output_type = TCC_OUTPUT_OBJ;
403 break;
404 case TCC_OPTION_isystem:
405 tcc_add_sysinclude_path(s, optarg);
406 break;
407 case TCC_OPTION_nostdinc:
408 s->nostdinc = 1;
409 break;
410 case TCC_OPTION_nostdlib:
411 s->nostdlib = 1;
412 break;
413 case TCC_OPTION_print_search_dirs:
414 print_search_dirs = 1;
415 break;
416 case TCC_OPTION_run:
418 int argc1;
419 char **argv1;
420 argc1 = expand_args(&argv1, optarg);
421 if (argc1 > 0) {
422 parse_args(s, argc1, argv1);
424 multiple_files = 0;
425 output_type = TCC_OUTPUT_MEMORY;
426 break;
428 case TCC_OPTION_v:
429 do ++s->verbose; while (*optarg++ == 'v');
430 break;
431 case TCC_OPTION_f:
432 if (tcc_set_flag(s, optarg, 1) < 0 && s->warn_unsupported)
433 goto unsupported_option;
434 break;
435 case TCC_OPTION_W:
436 if (tcc_set_warning(s, optarg, 1) < 0 &&
437 s->warn_unsupported)
438 goto unsupported_option;
439 break;
440 case TCC_OPTION_w:
441 s->warn_none = 1;
442 break;
443 case TCC_OPTION_rdynamic:
444 s->rdynamic = 1;
445 break;
446 case TCC_OPTION_Wl:
447 if (linker_arg.size)
448 --linker_arg.size, cstr_ccat(&linker_arg, ',');
449 cstr_cat(&linker_arg, optarg);
450 cstr_ccat(&linker_arg, '\0');
451 break;
452 case TCC_OPTION_E:
453 output_type = TCC_OUTPUT_PREPROCESS;
454 break;
455 case TCC_OPTION_MD:
456 gen_deps = 1;
457 break;
458 case TCC_OPTION_MF:
459 deps_outfile = optarg;
460 break;
461 case TCC_OPTION_x:
462 break;
463 default:
464 if (s->warn_unsupported) {
465 unsupported_option:
466 tcc_warning("unsupported option '%s'", r);
468 break;
472 if (NULL != (r1 = tcc_set_linker(s, (char *) linker_arg.data, TRUE)))
473 tcc_error("unsupported linker option '%s'", r1);
474 /* fixme: these options could be different on your platform */
475 if (was_pthread && output_type != TCC_OUTPUT_OBJ) {
476 dynarray_add((void ***)&files, &nb_files, "-lpthread");
477 nb_libraries++;
479 return optind;
482 #ifdef WITH_ATTACHMENTS
483 #include "tcc_attachments.h"
484 #define ATTACH_PREFIX "/_attach_"
486 static vio_module_t vio_module;
488 typedef struct vio_memfile_t {
489 off_t size;
490 off_t pos;
491 const unsigned char *mem;
492 } vio_memfile_t;
494 static int vio_mem_open(vio_fd *fd, const char *fn, int oflag) {
495 //printf("%d:%s\n", fd->fd, fn);
496 if(fd->vio_module && strncmp(ATTACH_PREFIX, fn, sizeof(ATTACH_PREFIX)-1) == 0){
497 int i, count = sizeof(bin2c_filesAttached)/sizeof(bin2c_filesAttached_st);
498 for(i=0; i < count; ++i) {
499 //printf("%s:%s\n", fn, bin2c_filesAttached[i].file_name);
500 if(strcmp(fn, bin2c_filesAttached[i].file_name) == 0) {
501 vio_memfile_t *mf = (vio_memfile_t*)tcc_malloc(sizeof(vio_memfile_t));
502 mf->mem = bin2c_filesAttached[i].sym_name;
503 mf->size = bin2c_filesAttached[i].size;
504 mf->pos = 0;
505 fd->fd = 1;
506 fd->vio_udata = mf;
507 //printf("%d:%s\n", fd->fd, fn);
508 return fd->fd;
512 return -1;
515 static off_t vio_mem_lseek(vio_fd fd, off_t offset, int whence) {
516 if(fd.vio_udata) {
517 off_t loffset = 0;
518 vio_memfile_t *mf = (vio_memfile_t*)fd.vio_udata;
519 if (whence == SEEK_CUR)
520 loffset = mf->pos + offset;
521 else if (whence == SEEK_SET)
522 loffset = offset;
523 else if (whence == SEEK_END)
524 loffset = ((off_t)mf->size) + offset;
526 if (loffset < 0 && loffset > mf->size)
527 return -1;
529 mf->pos = loffset;
531 return mf->pos;
533 return lseek(fd.fd, offset, whence);
536 static size_t vio_mem_read(vio_fd fd, void *buf, size_t bytes) {
537 if(fd.vio_udata) {
538 vio_memfile_t *mf = (vio_memfile_t*)fd.vio_udata;
539 if( (mf->pos + bytes) > mf->size) {
540 long bc = mf->size - mf->pos;
541 if(bc > 0) {
542 memcpy(buf, mf->mem + mf->pos, bc);
543 mf->pos = mf->size;
544 return bc;
546 return 0;
548 memcpy(buf, mf->mem + mf->pos, bytes);
549 mf->pos += bytes;
550 return bytes;
552 return 0;
555 static int vio_mem_close(vio_fd *fd) {
556 if(fd->vio_udata){
557 tcc_free(fd->vio_udata);
559 return 0;
562 void set_vio_module(TCCState *s){
563 vio_module.user_data = NULL;
564 vio_module.call_vio_open_flags = CALL_VIO_OPEN_FIRST;
565 vio_module.vio_open = &vio_mem_open;
566 vio_module.vio_lseek = &vio_mem_lseek;
567 vio_module.vio_read = &vio_mem_read;
568 vio_module.vio_close = &vio_mem_close;
569 tcc_set_vio_module(s, &vio_module);
572 #endif
574 int main(int argc, char **argv)
576 int i;
577 TCCState *s;
578 int nb_objfiles, ret, optind;
579 int64_t start_time = 0;
580 const char *default_file = NULL;
582 s = tcc_new();
584 output_type = TCC_OUTPUT_EXE;
585 outfile = NULL;
586 multiple_files = 1;
587 files = NULL;
588 nb_files = 0;
589 nb_libraries = 0;
590 reloc_output = 0;
591 print_search_dirs = 0;
592 m_option = NULL;
593 ret = 0;
595 #ifdef WITH_ATTACHMENTS
596 tcc_set_lib_path(s, ATTACH_PREFIX);
597 tcc_add_include_path(s, ATTACH_PREFIX);
598 set_vio_module(s);
599 #endif
600 optind = parse_args(s, argc - 1, argv + 1);
602 #if defined TCC_TARGET_X86_64 || defined TCC_TARGET_I386
603 if (m_option)
604 exec_other_tcc(s, argv, m_option);
605 #endif
607 if (print_search_dirs) {
608 /* enough for Linux kernel */
609 printf("install: %s/\n", s->tcc_lib_path);
610 return 0;
613 if (s->verbose)
614 printf("tcc version %s\n", TCC_VERSION);
616 if (optind == 0 || nb_files == 0) {
617 if (optind && s->verbose)
618 return 0;
619 help();
620 return 1;
623 nb_objfiles = nb_files - nb_libraries;
625 /* if outfile provided without other options, we output an
626 executable */
627 if (outfile && output_type == TCC_OUTPUT_MEMORY)
628 output_type = TCC_OUTPUT_EXE;
630 /* check -c consistency : only single file handled. XXX: checks file type */
631 if (output_type == TCC_OUTPUT_OBJ && !reloc_output) {
632 /* accepts only a single input file */
633 if (nb_objfiles != 1)
634 tcc_error("cannot specify multiple files with -c");
635 if (nb_libraries != 0)
636 tcc_error("cannot specify libraries with -c");
639 if (output_type == TCC_OUTPUT_PREPROCESS) {
640 if (!outfile) {
641 s->outfile = stdout;
642 } else {
643 s->outfile = fopen(outfile, "w");
644 if (!s->outfile)
645 tcc_error("could not open '%s'", outfile);
649 if (do_bench) {
650 start_time = getclock_us();
653 tcc_set_output_type(s, output_type);
654 s->reloc_output = reloc_output;
656 /* compile or add each files or library */
657 for(i = 0; i < nb_files && ret == 0; i++) {
658 const char *filename;
660 filename = files[i];
661 if (filename[0] == '-' && filename[1] == 'l') {
662 if (tcc_add_library(s, filename + 2) < 0) {
663 tcc_error_noabort("cannot find %s", filename);
664 ret = 1;
666 } else {
667 if (1 == s->verbose)
668 printf("-> %s\n", filename);
669 if (tcc_add_file(s, filename) < 0)
670 ret = 1;
671 if (!default_file)
672 default_file = filename;
676 /* free all files */
677 tcc_free(files);
679 if (0 == ret) {
680 if (do_bench)
681 tcc_print_stats(s, getclock_us() - start_time);
683 if (s->output_type == TCC_OUTPUT_MEMORY) {
684 #ifdef TCC_IS_NATIVE
685 ret = tcc_run(s, argc - 1 - optind, argv + 1 + optind);
686 #else
687 tcc_error_noabort("-run is not available in a cross compiler");
688 #endif
689 } else if (s->output_type == TCC_OUTPUT_PREPROCESS) {
690 if (s->outfile)
691 fclose(s->outfile);
692 } else {
693 if (!outfile)
694 outfile = tcc_default_target(s, default_file);
695 ret = !!tcc_output_file(s, outfile);
696 /* dump collected dependencies */
697 if (gen_deps && !ret)
698 tcc_gen_makedeps(s, outfile, deps_outfile);
702 tcc_delete(s);
703 cstr_free(&linker_arg);
704 tcc_free(outfile);
706 #ifdef MEM_DEBUG
707 if (do_bench) {
708 printf("memory: %d bytes, max = %d bytes\n", mem_cur_size, mem_max_size);
710 #endif
711 return ret;