Delete cpp generated comments

I use #include ".../frontend/tokens.mll"in lexer.mlland then cpp -C -P frontend/lexer.mll -o frontend/lexer_new.mllto create lexer_new.mll.

This worked until I updated my ubuntu from 12.04 to 14.04 yesterday.

An error message appears in the compilation:

ocamllex frontend/lexer_new.mll
File "frontend/lexer_new.mll", line 1, character 1: illegal character /.
make: *** [frontend/lexer_new.ml] Error 3

This is because lexer_new.mlla few lines of C comments were inserted at the beginning:

/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.
   ... */

I don’t remember if the same comments were created before the update.

Does anyone know how to get to these comments?

PS: gcc version: gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)

+1
source share
2 answers

Omitting the option -Cprohibits the copyright message entered.

From the documentation :

'- C'
  .   , ,   .

'-C';   .  , , ,     ,   '#'.

. -C . -, .

, . -C , , , C OCaml, lexer.mll lexer_new.mll; omitting -C . , -C , . ( .)

: running

cpp -C /dev/null

, /usr/include/stdc-predef.h:

$ cpp -C /dev/null
# 1 "/dev/null"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
   This file is part of the GNU C Library.
[39 lines deleted]
# 1 "/dev/null"
$

( -P #, , .) -, C. C- , __STDC_IEC_559__ __STDC_ISO_10646__.

-C -C-?

+1

( , ), CPP/GPP Fortran ( Fortran//)

, cpp, , , .

ubuntu 16.04

sudo apt-get install cpp-4.7

/usr/bin/cpp-4.7 -C -P myfile.F90 > myfile.f90
+1

Source: https://habr.com/ru/post/1664940/


All Articles