aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/adaint.c
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2015-05-27 15:26:16 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2015-05-27 15:26:16 +0200
commit50ef946c45a24d08fb3093401d45eb763fe86ea3 (patch)
tree245c403c097854f6ab68fac514ca38cc0bb4830e /gcc/ada/adaint.c
parent99206968a8da4e5342b498f264eb365e11a499c8 (diff)
downloadgcc-50ef946c45a24d08fb3093401d45eb763fe86ea3.zip
gcc-50ef946c45a24d08fb3093401d45eb763fe86ea3.tar.gz
gcc-50ef946c45a24d08fb3093401d45eb763fe86ea3.tar.bz2
[multiple changes]
2015-05-27 Robert Dewar <dewar@adacore.com> * sem_aux.adb: Minor rewording. 2015-05-27 Bob Duff <duff@adacore.com> * exp_prag.adb (Expand_Pragma_Abort_Defer): Make pragma Abort_Defer do nothing if Abort_Allowed is False. 2015-05-27 Arnaud Charlet <charlet@adacore.com> * exp_ch9.adb, sem_util.adb, sem_util.ads, s-stposu.adb, s-spsufi.ads, sem_elab.ads, g-comlin.ads, errout.ads, exp_ch6.adb, sem_ch4.adb, opt.ads, s-bignum.adb, output.ads, sem_ch13.adb, erroutc.ads, sem_disp.ads, exp_ch3.adb: Minor fixes of duplicate words in comments. 2015-05-27 Doug Rupp <rupp@adacore.com> * adaint.c (__gnat_tmp_name) [vxworks]: Robustify and use for rtp as well as kernel. 2015-05-27 Pierre-Marie de Rodat <derodat@adacore.com> * par_sco.adb (Process_Decision): Store sloc to condition/pragmas SCOs associations into a temporary table before moving them to the SCO_Raw_Hash_Table so that we can back them out just like we do for SCO entries that are simple decisions in an expression context. From-SVN: r223754
Diffstat (limited to 'gcc/ada/adaint.c')
-rw-r--r--gcc/ada/adaint.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 73eb814..9d4f051 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -1170,23 +1170,37 @@ __gnat_tmp_name (char *tmp_filename)
sprintf (tmp_filename, "%s/gnat-XXXXXX", tmpdir);
close (mkstemp(tmp_filename));
-#elif defined (__vxworks) && !(defined (__RTP__) || defined (VTHREADS))
- int index;
- char * pos;
- ushort_t t;
+#elif defined (__vxworks) && !defined (VTHREADS)
+ int index;
+ char *pos;
+ char *savepos;
static ushort_t seed = 0; /* used to generate unique name */
- /* generate unique name */
+ /* Generate a unique name. */
strcpy (tmp_filename, "tmp");
- /* fill up the name buffer from the last position */
index = 5;
- pos = tmp_filename + strlen (tmp_filename) + index;
+ savepos = pos = tmp_filename + strlen (tmp_filename) + index;
*pos = '\0';
- seed++;
- for (t = seed; 0 <= --index; t >>= 3)
- *--pos = '0' + (t & 07);
+ while (1)
+ {
+ FILE *f;
+ ushort_t t;
+
+ /* Fill up the name buffer from the last position. */
+ seed++;
+ for (t = seed; 0 <= --index; t >>= 3)
+ *--pos = '0' + (t & 07);
+
+ /* Check to see if its unique, if not bump the seed and try again. */
+ f = fopen (tmp_filename, "r");
+ if (f == NULL)
+ break;
+ fclose (f);
+ pos = savepos;
+ index = 5;
+ }
#else
tmpnam (tmp_filename);
#endif