public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "noloader at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/66943] GCC warns of Unknown Pragma for OpenMP, even though it support it.
Date: Mon, 20 Jul 2015 09:14:00 -0000	[thread overview]
Message-ID: <bug-66943-4-gddR0IoBsY@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-66943-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943

--- Comment #4 from Jeffrey Walton <noloader at gmail dot com> ---
(In reply to Andrew Pinski from comment #3)
> The warning is correct though, maybe it should add a message about needing
> -fopenmp to have them to be known.

>From a dumb user's point of view (folks like me): that behavior squashes a lot
of the benefit of cross-platform sources and using parallel tasks.

I think the OpenMP folks feel about the same. From
http://openmp.org/wp/openmp-specifications/ and
http://www.openmp.org/mp-documents/OpenMP4.0.0.pdf:

    Each directive starts with #pragma omp. The remainder of the
    directive follows the conventions of the C and C++ standards
    for compiler directives. In particular, white space can be
    used before and after the #, and sometimes white space must
    be used to separate the words in a directive. Preprocessing
    tokens following the #pragma omp are subject to macro
    replacement. 

There's no expectation that a conforming compiler will issue a warning for
#pragma omp when -fopenmp is not in effect. In fact, I can't find authority to
issue a warning from a conforming compiler.

I think it would be much better to always accept `#pragma omp` *if* the
compiler supports OpenMP, regardless of the status of `-fopenmp`. Conversely,
if the compiler does not support OpenMP, then always issue an unknown pragma
warning (modulo expected behavior of the diagnostic).

Speaking from experience, OpenBSD and Cygwin get into an odd area where they
advertise support for OpenMP by accepting -fopenmp and defining _OPENMP, but
then fail to compile the program. But I think that's a different issue.

(For what its worth, I understand the compiler writers are always right. They
are demi-gods in my little corner of the universe :)


  parent reply	other threads:[~2015-07-20  9:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-20  8:00 [Bug c++/66943] New: " noloader at gmail dot com
2015-07-20  8:09 ` [Bug c++/66943] " noloader at gmail dot com
2015-07-20  8:09 ` noloader at gmail dot com
2015-07-20  8:36 ` pinskia at gcc dot gnu.org
2015-07-20  9:14 ` noloader at gmail dot com [this message]
2015-07-20  9:58 ` manu at gcc dot gnu.org
2015-07-20 10:36 ` noloader at gmail dot com
2015-07-20 10:44 ` manu at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-66943-4-gddR0IoBsY@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).