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

            Bug ID: 119777
           Summary: [15 Regression] COBOL '-fsyntax-only',
                    'RejectNegative'
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: cobol
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tschwinge at gcc dot gnu.org
                CC: jklowden at gcc dot gnu.org, rdubner at gcc dot gnu.org
  Target Milestone: ---

I've noted this a few weeks ago, but only now getting to file a PR.

The 'gcc/cobol/lang.opt' file of commit
r15-7938-g3c5ed996ac94a15bc2929155f2c69cc85eef89f7 "COBOL: Frontend", added:

    +fsyntax-only
    +Cobol RejectNegative
    +; Documented in c.opt

..., but the (actually "Common", not "C") existing one is, 'gcc/common.opt':

    fsyntax-only
    Common Var(flag_syntax_only)
    Check for syntax errors, then stop.

The new 'gcc/cobol/lang.opt' one affects GCC's global option handling as
follows:

'build-gcc/gcc/optionlist':

    +fsyntax-only^\Cobol RejectNegative
     fsyntax-only^\Common Var(flag_syntax_only)^\Check for syntax errors, then
stop.

'build-gcc/gcc/options.cc':

     /* [-[1815]-]{+[1824]+} = */ {
        "-fsyntax-only",
        "Check for syntax errors, then stop.",
        NULL,
        NULL,
        NULL, NULL, N_OPTS, N_OPTS, 12, /* .neg_idx = */ [-1815,-]{+-1,+}
    {+    CL_Cobol |+} CL_COMMON,
        0, 0, 0, 0, 0, 0, [-0,-]{+1 /* RejectNegative */,+} 0, 0, 0, 0, 0,
        offsetof (struct gcc_options, x_flag_syntax_only), 0, CLVC_INTEGER, 0,
-1, -1 },

This means, '-fno-syntax-only' is now rejected (thus "15 Regression"), even for
non-COBOL:

    $ build-gcc/gcc/xgcc -Bbuild-gcc/gcc -fsyntax-only -fno-syntax-only -x c -S
/dev/null -o -
    xgcc: error: unrecognized command-line option ‘-fno-syntax-only’; did you
mean ‘-fsyntax-only’?

GCC 14:

    $ build-gcc/gcc/xgcc -Bbuild-gcc/gcc -fsyntax-only -fno-syntax-only -x c -S
/dev/null -o -
            .file   "null"
            .text
            .ident  "GCC: (GNU) 14.1.0"
            .section        .note.GNU-stack,"",@progbits

I guess there's no specific reason (for COBOL only) to reject
'-fno-syntax-only'?

Reply via email to