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

            Bug ID: 82892
           Summary: Spelling hints do not take into account missing
                    compiler options (e.g. -fopenmp)
           Product: gcc
           Version: 7.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anlauf at gmx dot de
  Target Milestone: ---

The nice diagnostics feature of spelling hints made me scratch my head
until I noticed that I forgot to provide the flag -fopenmp:

% cat print_openmp_version.c
#include <stdio.h>

int
main ()
{
  printf ("_OPENMP = %d\n", _OPENMP);
  return 0;
}

% gcc-7 print_openmp_version.c
print_openmp_version.c: In function 'main':
print_openmp_version.c:6:29: error: '_OPENMP' undeclared (first use in this
function); did you mean '_G_OPEN64'?
   printf ("_OPENMP = %d\n", _OPENMP);
                             ^~~~~~~
                             _G_OPEN64
print_openmp_version.c:6:29: note: each undeclared identifier is reported only
once for each function it appears in

% gcc-7 print_openmp_version.c -fopenmp

Would it make sense to extend this feature to appropriate compilation flags?

Reply via email to