summaryrefslogtreecommitdiff
path: root/libgomp/env.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2010-03-23 15:11:22 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2010-03-23 15:11:22 +0000
commit8ef83079e8afeb0ada8dd045ecca74cc63025815 (patch)
tree44efa0a8d484a43a1c9fdcb6ee639b42bc12b3b8 /libgomp/env.c
parentd1f34b6d3ee83ad3edafcebe24e66b410c8b99e3 (diff)
downloadgcc-8ef83079e8afeb0ada8dd045ecca74cc63025815.tar.gz
2010-03-23 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 157669 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@157672 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp/env.c')
-rw-r--r--libgomp/env.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/libgomp/env.c b/libgomp/env.c
index c870433f332..3eb51e8a7d6 100644
--- a/libgomp/env.c
+++ b/libgomp/env.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+ Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
@@ -145,7 +146,7 @@ parse_schedule (void)
present and it was successfully parsed. */
static bool
-parse_unsigned_long (const char *name, unsigned long *pvalue)
+parse_unsigned_long (const char *name, unsigned long *pvalue, bool allow_zero)
{
char *env, *end;
unsigned long value;
@@ -161,7 +162,7 @@ parse_unsigned_long (const char *name, unsigned long *pvalue)
errno = 0;
value = strtoul (env, &end, 10);
- if (errno || (long) value <= 0)
+ if (errno || (long) value <= 0 - allow_zero)
goto invalid;
while (isspace ((unsigned char) *end))
@@ -481,8 +482,9 @@ initialize_env (void)
parse_schedule ();
parse_boolean ("OMP_DYNAMIC", &gomp_global_icv.dyn_var);
parse_boolean ("OMP_NESTED", &gomp_global_icv.nest_var);
- parse_unsigned_long ("OMP_MAX_ACTIVE_LEVELS", &gomp_max_active_levels_var);
- parse_unsigned_long ("OMP_THREAD_LIMIT", &gomp_thread_limit_var);
+ parse_unsigned_long ("OMP_MAX_ACTIVE_LEVELS", &gomp_max_active_levels_var,
+ true);
+ parse_unsigned_long ("OMP_THREAD_LIMIT", &gomp_thread_limit_var, false);
if (gomp_thread_limit_var != ULONG_MAX)
gomp_remaining_threads_count = gomp_thread_limit_var - 1;
#ifndef HAVE_SYNC_BUILTINS
@@ -490,7 +492,8 @@ initialize_env (void)
#endif
gomp_init_num_threads ();
gomp_available_cpus = gomp_global_icv.nthreads_var;
- if (!parse_unsigned_long ("OMP_NUM_THREADS", &gomp_global_icv.nthreads_var))
+ if (!parse_unsigned_long ("OMP_NUM_THREADS", &gomp_global_icv.nthreads_var,
+ false))
gomp_global_icv.nthreads_var = gomp_available_cpus;
if (parse_affinity ())
gomp_init_affinity ();
@@ -632,7 +635,7 @@ omp_get_thread_limit (void)
void
omp_set_max_active_levels (int max_levels)
{
- if (max_levels > 0)
+ if (max_levels >= 0)
gomp_max_active_levels_var = max_levels;
}