0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

19.4.2 Header <cerrno> synopsis [cerrno.syn] C++N4910:2022 (386) p562.c

Last updated at Posted at 2022-07-15

はじめに(Introduction)

N4910 Working Draft, Standard for Programming Language C++

n4910は、ISO/IEC JTC1 SC22 WG21の作業原案(Working Draft)です。
公式のISO/IEC 14882原本ではありません。
ISO/IEC JTC1 SC22 WG21では、可能な限り作業文書を公開し、幅広い意見を求めています。
一連の記事はコード断片をコンパイルできる形にする方法を検討してコンパイル、リンク、実行して、規格案の原文と処理系(g++, Clang++)との違いを確認し、技術内容を検討し、ISO/IEC JTC1 SC22 WG21にフィードバックするために用います。
また、CERT C++, MISRA C++等のコーディング標準のコード断片をコンパイルする際の参考にさせていただこうと考えています。CERT C++, MISRA C++が標準化の動きとの時間的なずれがあれば確認できれば幸いです。また、boostライブラリとの関連、Linux OS, TOPPERSカーネル、g++(GCC), clang++(LLVM)との関係も調査中です。
何か、抜け漏れ、耳より情報がありましたらおしらせくださると幸いです。

<この項は書きかけです。順次追記します。>

背景(back ground)

C/C++でコンパイルエラーが出ると、途方にくれることがしばしばあります。
何回かに1回は、該当するエラーが検索できます。
ただ、条件が違っていて、そこでの修正方法では目的を達成しないこともしばしばです。いろいろな条件のコンパイルエラーとその対応方法について、広く記録することによって、いつか同じエラーに遭遇した時にやくに立つことを目指しています。

この半年の間で、三度、自分のネットでの記録に助けられたことがあります。
また過去に解決できなかった記録を10種類以上、最近になって解決できたことがあります。それは、主に次の3つの情報に基づいています。

https://stackoverflow.com
https://cpprefjp.github.io
http://ja.cppreference.com/

また
https://researchmap.jp/joub9b3my-1797580/#_1797580
に記載したサイトのお世話になっています。

作業方針(sequence)

Clang++では-std=c++03, C++2bの2種類
g++では-std=c++03, c++2bの2種類
でコンパイルし、

1)コンパイルエラーを収集する。
2)コンパイルエラーをなくす方法を検討する。
コンパイルエラーになる例を示すだけが目的のコードは、コンパイルエラーをなくすのではなく、コンパイルエラーの種類を収集するだけにする。
文法を示すのが目的のコード場合に、コンパイルエラーをなくすのに手間がかかる場合は、順次作業します。
3)リンクエラーをなくす方法を検討する。
文法を示すのが目的のコード場合に、リンクエラーをなくすのに手間がかかる場合は、順次作業します。
4)意味のある出力を作る。
コンパイル、リンクが通っても、意味のある出力を示そうとすると、コンパイル・リンクエラーが出て収拾できそうにない場合がある。順次作業します。

1)だけのものから4)まで進んだものと色々ある状態です。一歩でも前に進むご助言をお待ちしています。「検討事項」の欄に現状を記録するようにしています。

C++N4910:2022 Standard Working Draft on ISO/IEC 14882(0) sample code compile list

C++N4741, 2018 Standard Working Draft on ISO/IEC 14882 sample code compile list

C++N4606, 2016符号断片編纂一覧(example code compile list)

C++N4606, 2016 Working Draft 2016, ISO/IEC 14882, C++ standard(1) Example code compile list
https://qiita.com/kaizen_nagoya/items/df5d62c35bd6ed1c3d43/

C++N3242, 2011 sample code compile list on clang++ and g++

編纂器(Compiler)

clang++ --version

Debian clang version 14.0.5-++20220610033153+c12386ae247c-1~exp1~20220610153237.151
Target: x86_64-pc-linux-gnu, Thread model: posix, InstalledDir: /usr/bin

g++- --version

g++ (GCC) 12.1.0 Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

19.4.2 Header synopsis [cerrno.syn] C++N4910:2022 (386) p562.c

算譜(source code)

p562.cpp
// C++N4910 Committee Draft, Standard for Programming Language C++
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4910.pdf
const char * n4910 = "19.4.2 Header <cerrno> synopsis [cerrno.syn] C++N4910:2022 (386) p562.c";
// Debian clang version 14.0.5-++20220610033153+c12386ae247c-
// g++ (GCC) 12.1.0 Copyright (C) 2022 Free Software Foundation, Inc.
// Edited by Dr. OGAWA Kiyoshi. Compile procedure and results record.
// C++N4910:2022 Standard Working Draft on ISO/IEC 14882(0) sample code compile list
// https://qiita.com/kaizen_nagoya/items/fc957ddddd402004bb91

#include <iostream>
#include <cstdio>
#include <cstdlib> 
#include <cstring>
#include <cassert>
#include <coroutine>
#include <vector>
#include <complex>
#include <map>
#include <atomic>
#include <unordered_map>
#include <typeinfo>

using namespace std;

#define see_below int
// Example 1  
#define errno see_below
#define E2BIG see_below
#define EACCES see_below 
#define EADDRINUSE see_below 
#define EADDRNOTAVAIL see_below 
#define EAFNOSUPPORT see_below 
#define EAGAIN see_below 
#define EALREADY see_below 
#define EBADF see_below
#define EBADMSG see_below 
#define EBUSY see_below 
#define ECANCELED see_below 
#define ECHILD see_below 
#define ECONNABORTED see_below 
#define ECONNREFUSED see_below 
#define ECONNRESET see_below 
#define EDEADLK see_below 
#define EDESTADDRREQ see_below 
#define EDOM see_below
#define EEXIST see_below 
#define EFAULT see_below 
#define EFBIG see_below 
#define EHOSTUNREACH see_below 
#define EIDRM see_below 
#define EILSEQ see_below 
#define EINPROGRESS see_below 
#define EINTR see_below 
#define EINVAL see_below 
#define EIO see_below
#define EISCONN see_below
#define EISDIR see_below
#define ELOOP see_below
#define EMFILE see_below
#define EMLINK see_below
#define EMSGSIZE see_below 
#define ENAMETOOLONG see_below 
#define ENETDOWN see_below 
#define ENETRESET see_below 
#define ENETUNREACH see_below 
#define ENFILE see_below
#define ENOBUFS see_below
#define ENODATA see_below
#define ENODEV see_below
#define ENOENT see_below
#define ENOEXEC see_below
#define ENOLCK see_below
#define ENOLINK see_below
#define ENOMEM see_below
#define ENOMSG see_below
#define ENOPROTOOPT see_below 
#define ENOSPC see_below
#define ENOSR see_below
#define ENOSTR see_below
#define ENOSYS see_below
#define ENOTCONN see_below 
#define ENOTDIR see_below
#define ENOTEMPTY see_below 
#define ENOTRECOVERABLE see_below 
#define ENOTSOCK see_below 
#define ENOTSUP see_below
#define ENOTTY see_below 
#define ENXIO see_below 
#define EOPNOTSUPP see_below 
#define EOVERFLOW see_below 
#define EOWNERDEAD see_below
#define EPERM see_below
#define EPIPE see_below
#define EPROTO see_below
#define EPROTONOSUPPORT see_below 
#define EPROTOTYPE see_below 
#define ERANGE see_below
#define EROFS see_below 
#define ESPIPE see_below 
#define ESRCH see_below 
#define ETIME see_below 
#define ETIMEDOUT see_below 
#define ETXTBSY see_below 
#define EWOULDBLOCK see_below 
#define EXDEV see_below
int main(){
  cout  <<  n4910 << endl;
  return EXIT_SUCCESS;
}

編纂・実行結果(compile and go)

bash
$ clang++ p562.cpp -std=c++03 -o p562l -I. -Wall
In file included from p562.cpp:19:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/atomic:38:
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/c++0x_warning.h:32:2: error: This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
 ^
1 error generated.
rm: cannot remove 'p562l': No such file or directory
$ clang++ p562.cpp -std=c++2b -o p562l -I. -Wall
p562.cpp:27:9: warning: 'errno' macro redefined [-Wmacro-redefined]
#define errno see_below
        ^
/usr/include/errno.h:38:10: note: previous definition is here
# define errno (*__errno_location ())
         ^
p562.cpp:28:9: warning: 'E2BIG' macro redefined [-Wmacro-redefined]
#define E2BIG see_below
        ^
/usr/include/asm-generic/errno-base.h:11:9: note: previous definition is here
#define E2BIG            7      /* Argument list too long */
        ^
p562.cpp:29:9: warning: 'EACCES' macro redefined [-Wmacro-redefined]
#define EACCES see_below 
        ^
/usr/include/asm-generic/errno-base.h:17:9: note: previous definition is here
#define EACCES          13      /* Permission denied */
        ^
p562.cpp:30:9: warning: 'EADDRINUSE' macro redefined [-Wmacro-redefined]
#define EADDRINUSE see_below 
        ^
/usr/include/asm-generic/errno.h:81:9: note: previous definition is here
#define EADDRINUSE      98      /* Address already in use */
        ^
p562.cpp:31:9: warning: 'EADDRNOTAVAIL' macro redefined [-Wmacro-redefined]
#define EADDRNOTAVAIL see_below 
        ^
/usr/include/asm-generic/errno.h:82:9: note: previous definition is here
#define EADDRNOTAVAIL   99      /* Cannot assign requested address */
        ^
p562.cpp:32:9: warning: 'EAFNOSUPPORT' macro redefined [-Wmacro-redefined]
#define EAFNOSUPPORT see_below 
        ^
/usr/include/asm-generic/errno.h:80:9: note: previous definition is here
#define EAFNOSUPPORT    97      /* Address family not supported by protocol */
        ^
p562.cpp:33:9: warning: 'EAGAIN' macro redefined [-Wmacro-redefined]
#define EAGAIN see_below 
        ^
/usr/include/asm-generic/errno-base.h:15:9: note: previous definition is here
#define EAGAIN          11      /* Try again */
        ^
p562.cpp:34:9: warning: 'EALREADY' macro redefined [-Wmacro-redefined]
#define EALREADY see_below 
        ^
/usr/include/asm-generic/errno.h:97:9: note: previous definition is here
#define EALREADY        114     /* Operation already in progress */
        ^
p562.cpp:35:9: warning: 'EBADF' macro redefined [-Wmacro-redefined]
#define EBADF see_below
        ^
/usr/include/asm-generic/errno-base.h:13:9: note: previous definition is here
#define EBADF            9      /* Bad file number */
        ^
p562.cpp:36:9: warning: 'EBADMSG' macro redefined [-Wmacro-redefined]
#define EBADMSG see_below 
        ^
/usr/include/asm-generic/errno.h:57:9: note: previous definition is here
#define EBADMSG         74      /* Not a data message */
        ^
p562.cpp:37:9: warning: 'EBUSY' macro redefined [-Wmacro-redefined]
#define EBUSY see_below 
        ^
/usr/include/asm-generic/errno-base.h:20:9: note: previous definition is here
#define EBUSY           16      /* Device or resource busy */
        ^
p562.cpp:38:9: warning: 'ECANCELED' macro redefined [-Wmacro-redefined]
#define ECANCELED see_below 
        ^
/usr/include/asm-generic/errno.h:109:9: note: previous definition is here
#define ECANCELED       125     /* Operation Canceled */
        ^
p562.cpp:39:9: warning: 'ECHILD' macro redefined [-Wmacro-redefined]
#define ECHILD see_below 
        ^
/usr/include/asm-generic/errno-base.h:14:9: note: previous definition is here
#define ECHILD          10      /* No child processes */
        ^
p562.cpp:40:9: warning: 'ECONNABORTED' macro redefined [-Wmacro-redefined]
#define ECONNABORTED see_below 
        ^
/usr/include/asm-generic/errno.h:86:9: note: previous definition is here
#define ECONNABORTED    103     /* Software caused connection abort */
        ^
p562.cpp:41:9: warning: 'ECONNREFUSED' macro redefined [-Wmacro-redefined]
#define ECONNREFUSED see_below 
        ^
/usr/include/asm-generic/errno.h:94:9: note: previous definition is here
#define ECONNREFUSED    111     /* Connection refused */
        ^
p562.cpp:42:9: warning: 'ECONNRESET' macro redefined [-Wmacro-redefined]
#define ECONNRESET see_below 
        ^
/usr/include/asm-generic/errno.h:87:9: note: previous definition is here
#define ECONNRESET      104     /* Connection reset by peer */
        ^
p562.cpp:43:9: warning: 'EDEADLK' macro redefined [-Wmacro-redefined]
#define EDEADLK see_below 
        ^
/usr/include/asm-generic/errno.h:7:9: note: previous definition is here
#define EDEADLK         35      /* Resource deadlock would occur */
        ^
p562.cpp:44:9: warning: 'EDESTADDRREQ' macro redefined [-Wmacro-redefined]
#define EDESTADDRREQ see_below 
        ^
/usr/include/asm-generic/errno.h:72:9: note: previous definition is here
#define EDESTADDRREQ    89      /* Destination address required */
        ^
p562.cpp:45:9: warning: 'EDOM' macro redefined [-Wmacro-redefined]
#define EDOM see_below
        ^
/usr/include/asm-generic/errno-base.h:37:9: note: previous definition is here
#define EDOM            33      /* Math argument out of domain of func */
        ^
p562.cpp:46:9: warning: 'EEXIST' macro redefined [-Wmacro-redefined]
#define EEXIST see_below 
        ^
/usr/include/asm-generic/errno-base.h:21:9: note: previous definition is here
#define EEXIST          17      /* File exists */
        ^
p562.cpp:47:9: warning: 'EFAULT' macro redefined [-Wmacro-redefined]
#define EFAULT see_below 
        ^
/usr/include/asm-generic/errno-base.h:18:9: note: previous definition is here
#define EFAULT          14      /* Bad address */
        ^
p562.cpp:48:9: warning: 'EFBIG' macro redefined [-Wmacro-redefined]
#define EFBIG see_below 
        ^
/usr/include/asm-generic/errno-base.h:31:9: note: previous definition is here
#define EFBIG           27      /* File too large */
        ^
p562.cpp:49:9: warning: 'EHOSTUNREACH' macro redefined [-Wmacro-redefined]
#define EHOSTUNREACH see_below 
        ^
/usr/include/asm-generic/errno.h:96:9: note: previous definition is here
#define EHOSTUNREACH    113     /* No route to host */
        ^
p562.cpp:50:9: warning: 'EIDRM' macro redefined [-Wmacro-redefined]
#define EIDRM see_below 
        ^
/usr/include/asm-generic/errno.h:24:9: note: previous definition is here
#define EIDRM           43      /* Identifier removed */
        ^
p562.cpp:51:9: warning: 'EILSEQ' macro redefined [-Wmacro-redefined]
#define EILSEQ see_below 
        ^
/usr/include/asm-generic/errno.h:67:9: note: previous definition is here
#define EILSEQ          84      /* Illegal byte sequence */
        ^
p562.cpp:52:9: warning: 'EINPROGRESS' macro redefined [-Wmacro-redefined]
#define EINPROGRESS see_below 
        ^
/usr/include/asm-generic/errno.h:98:9: note: previous definition is here
#define EINPROGRESS     115     /* Operation now in progress */
        ^
p562.cpp:53:9: warning: 'EINTR' macro redefined [-Wmacro-redefined]
#define EINTR see_below 
        ^
/usr/include/asm-generic/errno-base.h:8:9: note: previous definition is here
#define EINTR            4      /* Interrupted system call */
        ^
p562.cpp:54:9: warning: 'EINVAL' macro redefined [-Wmacro-redefined]
#define EINVAL see_below 
        ^
/usr/include/asm-generic/errno-base.h:26:9: note: previous definition is here
#define EINVAL          22      /* Invalid argument */
        ^
p562.cpp:55:9: warning: 'EIO' macro redefined [-Wmacro-redefined]
#define EIO see_below
        ^
/usr/include/asm-generic/errno-base.h:9:9: note: previous definition is here
#define EIO              5      /* I/O error */
        ^
p562.cpp:56:9: warning: 'EISCONN' macro redefined [-Wmacro-redefined]
#define EISCONN see_below
        ^
/usr/include/asm-generic/errno.h:89:9: note: previous definition is here
#define EISCONN         106     /* Transport endpoint is already connected */
        ^
p562.cpp:57:9: warning: 'EISDIR' macro redefined [-Wmacro-redefined]
#define EISDIR see_below
        ^
/usr/include/asm-generic/errno-base.h:25:9: note: previous definition is here
#define EISDIR          21      /* Is a directory */
        ^
p562.cpp:58:9: warning: 'ELOOP' macro redefined [-Wmacro-redefined]
#define ELOOP see_below
        ^
/usr/include/asm-generic/errno.h:21:9: note: previous definition is here
#define ELOOP           40      /* Too many symbolic links encountered */
        ^
p562.cpp:59:9: warning: 'EMFILE' macro redefined [-Wmacro-redefined]
#define EMFILE see_below
        ^
/usr/include/asm-generic/errno-base.h:28:9: note: previous definition is here
#define EMFILE          24      /* Too many open files */
        ^
p562.cpp:60:9: warning: 'EMLINK' macro redefined [-Wmacro-redefined]
#define EMLINK see_below
        ^
/usr/include/asm-generic/errno-base.h:35:9: note: previous definition is here
#define EMLINK          31      /* Too many links */
        ^
p562.cpp:61:9: warning: 'EMSGSIZE' macro redefined [-Wmacro-redefined]
#define EMSGSIZE see_below 
        ^
/usr/include/asm-generic/errno.h:73:9: note: previous definition is here
#define EMSGSIZE        90      /* Message too long */
        ^
p562.cpp:62:9: warning: 'ENAMETOOLONG' macro redefined [-Wmacro-redefined]
#define ENAMETOOLONG see_below 
        ^
/usr/include/asm-generic/errno.h:8:9: note: previous definition is here
#define ENAMETOOLONG    36      /* File name too long */
        ^
p562.cpp:63:9: warning: 'ENETDOWN' macro redefined [-Wmacro-redefined]
#define ENETDOWN see_below 
        ^
/usr/include/asm-generic/errno.h:83:9: note: previous definition is here
#define ENETDOWN        100     /* Network is down */
        ^
p562.cpp:64:9: warning: 'ENETRESET' macro redefined [-Wmacro-redefined]
#define ENETRESET see_below 
        ^
/usr/include/asm-generic/errno.h:85:9: note: previous definition is here
#define ENETRESET       102     /* Network dropped connection because of reset */
        ^
p562.cpp:65:9: warning: 'ENETUNREACH' macro redefined [-Wmacro-redefined]
#define ENETUNREACH see_below 
        ^
/usr/include/asm-generic/errno.h:84:9: note: previous definition is here
#define ENETUNREACH     101     /* Network is unreachable */
        ^
p562.cpp:66:9: warning: 'ENFILE' macro redefined [-Wmacro-redefined]
#define ENFILE see_below
        ^
/usr/include/asm-generic/errno-base.h:27:9: note: previous definition is here
#define ENFILE          23      /* File table overflow */
        ^
p562.cpp:67:9: warning: 'ENOBUFS' macro redefined [-Wmacro-redefined]
#define ENOBUFS see_below
        ^
/usr/include/asm-generic/errno.h:88:9: note: previous definition is here
#define ENOBUFS         105     /* No buffer space available */
        ^
p562.cpp:68:9: warning: 'ENODATA' macro redefined [-Wmacro-redefined]
#define ENODATA see_below
        ^
/usr/include/asm-generic/errno.h:44:9: note: previous definition is here
#define ENODATA         61      /* No data available */
        ^
p562.cpp:69:9: warning: 'ENODEV' macro redefined [-Wmacro-redefined]
#define ENODEV see_below
        ^
/usr/include/asm-generic/errno-base.h:23:9: note: previous definition is here
#define ENODEV          19      /* No such device */
        ^
p562.cpp:70:9: warning: 'ENOENT' macro redefined [-Wmacro-redefined]
#define ENOENT see_below
        ^
/usr/include/asm-generic/errno-base.h:6:9: note: previous definition is here
#define ENOENT           2      /* No such file or directory */
        ^
p562.cpp:71:9: warning: 'ENOEXEC' macro redefined [-Wmacro-redefined]
#define ENOEXEC see_below
        ^
/usr/include/asm-generic/errno-base.h:12:9: note: previous definition is here
#define ENOEXEC          8      /* Exec format error */
        ^
p562.cpp:72:9: warning: 'ENOLCK' macro redefined [-Wmacro-redefined]
#define ENOLCK see_below
        ^
/usr/include/asm-generic/errno.h:9:9: note: previous definition is here
#define ENOLCK          37      /* No record locks available */
        ^
p562.cpp:73:9: warning: 'ENOLINK' macro redefined [-Wmacro-redefined]
#define ENOLINK see_below
        ^
/usr/include/asm-generic/errno.h:50:9: note: previous definition is here
#define ENOLINK         67      /* Link has been severed */
        ^
p562.cpp:74:9: warning: 'ENOMEM' macro redefined [-Wmacro-redefined]
#define ENOMEM see_below
        ^
/usr/include/asm-generic/errno-base.h:16:9: note: previous definition is here
#define ENOMEM          12      /* Out of memory */
        ^
p562.cpp:75:9: warning: 'ENOMSG' macro redefined [-Wmacro-redefined]
#define ENOMSG see_below
        ^
/usr/include/asm-generic/errno.h:23:9: note: previous definition is here
#define ENOMSG          42      /* No message of desired type */
        ^
p562.cpp:76:9: warning: 'ENOPROTOOPT' macro redefined [-Wmacro-redefined]
#define ENOPROTOOPT see_below 
        ^
/usr/include/asm-generic/errno.h:75:9: note: previous definition is here
#define ENOPROTOOPT     92      /* Protocol not available */
        ^
p562.cpp:77:9: warning: 'ENOSPC' macro redefined [-Wmacro-redefined]
#define ENOSPC see_below
        ^
/usr/include/asm-generic/errno-base.h:32:9: note: previous definition is here
#define ENOSPC          28      /* No space left on device */
        ^
p562.cpp:78:9: warning: 'ENOSR' macro redefined [-Wmacro-redefined]
#define ENOSR see_below
        ^
/usr/include/asm-generic/errno.h:46:9: note: previous definition is here
#define ENOSR           63      /* Out of streams resources */
        ^
p562.cpp:79:9: warning: 'ENOSTR' macro redefined [-Wmacro-redefined]
#define ENOSTR see_below
        ^
/usr/include/asm-generic/errno.h:43:9: note: previous definition is here
#define ENOSTR          60      /* Device not a stream */
        ^
p562.cpp:80:9: warning: 'ENOSYS' macro redefined [-Wmacro-redefined]
#define ENOSYS see_below
        ^
/usr/include/asm-generic/errno.h:18:9: note: previous definition is here
#define ENOSYS          38      /* Invalid system call number */
        ^
p562.cpp:81:9: warning: 'ENOTCONN' macro redefined [-Wmacro-redefined]
#define ENOTCONN see_below 
        ^
/usr/include/asm-generic/errno.h:90:9: note: previous definition is here
#define ENOTCONN        107     /* Transport endpoint is not connected */
        ^
p562.cpp:82:9: warning: 'ENOTDIR' macro redefined [-Wmacro-redefined]
#define ENOTDIR see_below
        ^
/usr/include/asm-generic/errno-base.h:24:9: note: previous definition is here
#define ENOTDIR         20      /* Not a directory */
        ^
p562.cpp:83:9: warning: 'ENOTEMPTY' macro redefined [-Wmacro-redefined]
#define ENOTEMPTY see_below 
        ^
/usr/include/asm-generic/errno.h:20:9: note: previous definition is here
#define ENOTEMPTY       39      /* Directory not empty */
        ^
p562.cpp:84:9: warning: 'ENOTRECOVERABLE' macro redefined [-Wmacro-redefined]
#define ENOTRECOVERABLE see_below 
        ^
/usr/include/asm-generic/errno.h:117:9: note: previous definition is here
#define ENOTRECOVERABLE 131     /* State not recoverable */
        ^
p562.cpp:85:9: warning: 'ENOTSOCK' macro redefined [-Wmacro-redefined]
#define ENOTSOCK see_below 
        ^
/usr/include/asm-generic/errno.h:71:9: note: previous definition is here
#define ENOTSOCK        88      /* Socket operation on non-socket */
        ^
p562.cpp:86:9: warning: 'ENOTSUP' macro redefined [-Wmacro-redefined]
#define ENOTSUP see_below
        ^
/usr/include/x86_64-linux-gnu/bits/errno.h:30:11: note: previous definition is here
#  define ENOTSUP               EOPNOTSUPP
          ^
p562.cpp:87:9: warning: 'ENOTTY' macro redefined [-Wmacro-redefined]
#define ENOTTY see_below 
        ^
/usr/include/asm-generic/errno-base.h:29:9: note: previous definition is here
#define ENOTTY          25      /* Not a typewriter */
        ^
p562.cpp:88:9: warning: 'ENXIO' macro redefined [-Wmacro-redefined]
#define ENXIO see_below 
        ^
/usr/include/asm-generic/errno-base.h:10:9: note: previous definition is here
#define ENXIO            6      /* No such device or address */
        ^
p562.cpp:89:9: warning: 'EOPNOTSUPP' macro redefined [-Wmacro-redefined]
#define EOPNOTSUPP see_below 
        ^
/usr/include/asm-generic/errno.h:78:9: note: previous definition is here
#define EOPNOTSUPP      95      /* Operation not supported on transport endpoint */
        ^
p562.cpp:90:9: warning: 'EOVERFLOW' macro redefined [-Wmacro-redefined]
#define EOVERFLOW see_below 
        ^
/usr/include/asm-generic/errno.h:58:9: note: previous definition is here
#define EOVERFLOW       75      /* Value too large for defined data type */
        ^
p562.cpp:91:9: warning: 'EOWNERDEAD' macro redefined [-Wmacro-redefined]
#define EOWNERDEAD see_below
        ^
/usr/include/asm-generic/errno.h:116:9: note: previous definition is here
#define EOWNERDEAD      130     /* Owner died */
        ^
p562.cpp:92:9: warning: 'EPERM' macro redefined [-Wmacro-redefined]
#define EPERM see_below
        ^
/usr/include/asm-generic/errno-base.h:5:9: note: previous definition is here
#define EPERM            1      /* Operation not permitted */
        ^
p562.cpp:93:9: warning: 'EPIPE' macro redefined [-Wmacro-redefined]
#define EPIPE see_below
        ^
/usr/include/asm-generic/errno-base.h:36:9: note: previous definition is here
#define EPIPE           32      /* Broken pipe */
        ^
p562.cpp:94:9: warning: 'EPROTO' macro redefined [-Wmacro-redefined]
#define EPROTO see_below
        ^
/usr/include/asm-generic/errno.h:54:9: note: previous definition is here
#define EPROTO          71      /* Protocol error */
        ^
p562.cpp:95:9: warning: 'EPROTONOSUPPORT' macro redefined [-Wmacro-redefined]
#define EPROTONOSUPPORT see_below 
        ^
/usr/include/asm-generic/errno.h:76:9: note: previous definition is here
#define EPROTONOSUPPORT 93      /* Protocol not supported */
        ^
p562.cpp:96:9: warning: 'EPROTOTYPE' macro redefined [-Wmacro-redefined]
#define EPROTOTYPE see_below 
        ^
/usr/include/asm-generic/errno.h:74:9: note: previous definition is here
#define EPROTOTYPE      91      /* Protocol wrong type for socket */
        ^
p562.cpp:97:9: warning: 'ERANGE' macro redefined [-Wmacro-redefined]
#define ERANGE see_below
        ^
/usr/include/asm-generic/errno-base.h:38:9: note: previous definition is here
#define ERANGE          34      /* Math result not representable */
        ^
p562.cpp:98:9: warning: 'EROFS' macro redefined [-Wmacro-redefined]
#define EROFS see_below 
        ^
/usr/include/asm-generic/errno-base.h:34:9: note: previous definition is here
#define EROFS           30      /* Read-only file system */
        ^
p562.cpp:99:9: warning: 'ESPIPE' macro redefined [-Wmacro-redefined]
#define ESPIPE see_below 
        ^
/usr/include/asm-generic/errno-base.h:33:9: note: previous definition is here
#define ESPIPE          29      /* Illegal seek */
        ^
p562.cpp:100:9: warning: 'ESRCH' macro redefined [-Wmacro-redefined]
#define ESRCH see_below 
        ^
/usr/include/asm-generic/errno-base.h:7:9: note: previous definition is here
#define ESRCH            3      /* No such process */
        ^
p562.cpp:101:9: warning: 'ETIME' macro redefined [-Wmacro-redefined]
#define ETIME see_below 
        ^
/usr/include/asm-generic/errno.h:45:9: note: previous definition is here
#define ETIME           62      /* Timer expired */
        ^
p562.cpp:102:9: warning: 'ETIMEDOUT' macro redefined [-Wmacro-redefined]
#define ETIMEDOUT see_below 
        ^
/usr/include/asm-generic/errno.h:93:9: note: previous definition is here
#define ETIMEDOUT       110     /* Connection timed out */
        ^
p562.cpp:103:9: warning: 'ETXTBSY' macro redefined [-Wmacro-redefined]
#define ETXTBSY see_below 
        ^
/usr/include/asm-generic/errno-base.h:30:9: note: previous definition is here
#define ETXTBSY         26      /* Text file busy */
        ^
p562.cpp:104:9: warning: 'EWOULDBLOCK' macro redefined [-Wmacro-redefined]
#define EWOULDBLOCK see_below 
        ^
/usr/include/asm-generic/errno.h:22:9: note: previous definition is here
#define EWOULDBLOCK     EAGAIN  /* Operation would block */
        ^
p562.cpp:105:9: warning: 'EXDEV' macro redefined [-Wmacro-redefined]
#define EXDEV see_below
        ^
/usr/include/asm-generic/errno-base.h:22:9: note: previous definition is here
#define EXDEV           18      /* Cross-device link */
        ^
79 warnings generated.
19.4.2 Header <cerrno> synopsis [cerrno.syn] C++N4910:2022 (386) p562.c

$ g++ p562.cpp -std=c++03 -o p562g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
                 from p562.cpp:19:
/usr/local/include/c++/12.1.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
   32 | #error This file requires compiler and library support \
      |  ^~~~~
rm: cannot remove 'p562g': No such file or directory

$ g++ p562.cpp -std=c++2b -o p562g -I. -Wall
p562.cpp:27: warning: "errno" redefined
   27 | #define errno see_below
      | 
In file included from /usr/local/include/c++/12.1.0/cerrno:42,
                 from /usr/local/include/c++/12.1.0/ext/string_conversions.h:44,
                 from /usr/local/include/c++/12.1.0/bits/basic_string.h:3960,
                 from /usr/local/include/c++/12.1.0/string:53,
                 from /usr/local/include/c++/12.1.0/bits/locale_classes.h:40,
                 from /usr/local/include/c++/12.1.0/bits/ios_base.h:41,
                 from /usr/local/include/c++/12.1.0/ios:42,
                 from /usr/local/include/c++/12.1.0/ostream:38,
                 from /usr/local/include/c++/12.1.0/iostream:39,
                 from p562.cpp:10:
/usr/include/errno.h:38: note: this is the location of the previous definition
   38 | # define errno (*__errno_location ())
      | 
p562.cpp:28: warning: "E2BIG" redefined
   28 | #define E2BIG see_below
      | 
In file included from /usr/include/asm-generic/errno.h:5,
                 from /usr/include/x86_64-linux-gnu/asm/errno.h:1,
                 from /usr/include/linux/errno.h:1,
                 from /usr/include/x86_64-linux-gnu/bits/errno.h:26,
                 from /usr/include/errno.h:28:
/usr/include/asm-generic/errno-base.h:11: note: this is the location of the previous definition
   11 | #define E2BIG            7      /* Argument list too long */
      | 
p562.cpp:29: warning: "EACCES" redefined
   29 | #define EACCES see_below
      | 
/usr/include/asm-generic/errno-base.h:17: note: this is the location of the previous definition
   17 | #define EACCES          13      /* Permission denied */
      | 
p562.cpp:30: warning: "EADDRINUSE" redefined
   30 | #define EADDRINUSE see_below
      | 
/usr/include/asm-generic/errno.h:81: note: this is the location of the previous definition
   81 | #define EADDRINUSE      98      /* Address already in use */
      | 
p562.cpp:31: warning: "EADDRNOTAVAIL" redefined
   31 | #define EADDRNOTAVAIL see_below
      | 
/usr/include/asm-generic/errno.h:82: note: this is the location of the previous definition
   82 | #define EADDRNOTAVAIL   99      /* Cannot assign requested address */
      | 
p562.cpp:32: warning: "EAFNOSUPPORT" redefined
   32 | #define EAFNOSUPPORT see_below
      | 
/usr/include/asm-generic/errno.h:80: note: this is the location of the previous definition
   80 | #define EAFNOSUPPORT    97      /* Address family not supported by protocol */
      | 
p562.cpp:33: warning: "EAGAIN" redefined
   33 | #define EAGAIN see_below
      | 
/usr/include/asm-generic/errno-base.h:15: note: this is the location of the previous definition
   15 | #define EAGAIN          11      /* Try again */
      | 
p562.cpp:34: warning: "EALREADY" redefined
   34 | #define EALREADY see_below
      | 
/usr/include/asm-generic/errno.h:97: note: this is the location of the previous definition
   97 | #define EALREADY        114     /* Operation already in progress */
      | 
p562.cpp:35: warning: "EBADF" redefined
   35 | #define EBADF see_below
      | 
/usr/include/asm-generic/errno-base.h:13: note: this is the location of the previous definition
   13 | #define EBADF            9      /* Bad file number */
      | 
p562.cpp:36: warning: "EBADMSG" redefined
   36 | #define EBADMSG see_below
      | 
/usr/include/asm-generic/errno.h:57: note: this is the location of the previous definition
   57 | #define EBADMSG         74      /* Not a data message */
      | 
p562.cpp:37: warning: "EBUSY" redefined
   37 | #define EBUSY see_below
      | 
/usr/include/asm-generic/errno-base.h:20: note: this is the location of the previous definition
   20 | #define EBUSY           16      /* Device or resource busy */
      | 
p562.cpp:38: warning: "ECANCELED" redefined
   38 | #define ECANCELED see_below
      | 
/usr/include/asm-generic/errno.h:109: note: this is the location of the previous definition
  109 | #define ECANCELED       125     /* Operation Canceled */
      | 
p562.cpp:39: warning: "ECHILD" redefined
   39 | #define ECHILD see_below
      | 
/usr/include/asm-generic/errno-base.h:14: note: this is the location of the previous definition
   14 | #define ECHILD          10      /* No child processes */
      | 
p562.cpp:40: warning: "ECONNABORTED" redefined
   40 | #define ECONNABORTED see_below
      | 
/usr/include/asm-generic/errno.h:86: note: this is the location of the previous definition
   86 | #define ECONNABORTED    103     /* Software caused connection abort */
      | 
p562.cpp:41: warning: "ECONNREFUSED" redefined
   41 | #define ECONNREFUSED see_below
      | 
/usr/include/asm-generic/errno.h:94: note: this is the location of the previous definition
   94 | #define ECONNREFUSED    111     /* Connection refused */
      | 
p562.cpp:42: warning: "ECONNRESET" redefined
   42 | #define ECONNRESET see_below
      | 
/usr/include/asm-generic/errno.h:87: note: this is the location of the previous definition
   87 | #define ECONNRESET      104     /* Connection reset by peer */
      | 
p562.cpp:43: warning: "EDEADLK" redefined
   43 | #define EDEADLK see_below
      | 
/usr/include/asm-generic/errno.h:7: note: this is the location of the previous definition
    7 | #define EDEADLK         35      /* Resource deadlock would occur */
      | 
p562.cpp:44: warning: "EDESTADDRREQ" redefined
   44 | #define EDESTADDRREQ see_below
      | 
/usr/include/asm-generic/errno.h:72: note: this is the location of the previous definition
   72 | #define EDESTADDRREQ    89      /* Destination address required */
      | 
p562.cpp:45: warning: "EDOM" redefined
   45 | #define EDOM see_below
      | 
/usr/include/asm-generic/errno-base.h:37: note: this is the location of the previous definition
   37 | #define EDOM            33      /* Math argument out of domain of func */
      | 
p562.cpp:46: warning: "EEXIST" redefined
   46 | #define EEXIST see_below
      | 
/usr/include/asm-generic/errno-base.h:21: note: this is the location of the previous definition
   21 | #define EEXIST          17      /* File exists */
      | 
p562.cpp:47: warning: "EFAULT" redefined
   47 | #define EFAULT see_below
      | 
/usr/include/asm-generic/errno-base.h:18: note: this is the location of the previous definition
   18 | #define EFAULT          14      /* Bad address */
      | 
p562.cpp:48: warning: "EFBIG" redefined
   48 | #define EFBIG see_below
      | 
/usr/include/asm-generic/errno-base.h:31: note: this is the location of the previous definition
   31 | #define EFBIG           27      /* File too large */
      | 
p562.cpp:49: warning: "EHOSTUNREACH" redefined
   49 | #define EHOSTUNREACH see_below
      | 
/usr/include/asm-generic/errno.h:96: note: this is the location of the previous definition
   96 | #define EHOSTUNREACH    113     /* No route to host */
      | 
p562.cpp:50: warning: "EIDRM" redefined
   50 | #define EIDRM see_below
      | 
/usr/include/asm-generic/errno.h:24: note: this is the location of the previous definition
   24 | #define EIDRM           43      /* Identifier removed */
      | 
p562.cpp:51: warning: "EILSEQ" redefined
   51 | #define EILSEQ see_below
      | 
/usr/include/asm-generic/errno.h:67: note: this is the location of the previous definition
   67 | #define EILSEQ          84      /* Illegal byte sequence */
      | 
p562.cpp:52: warning: "EINPROGRESS" redefined
   52 | #define EINPROGRESS see_below
      | 
/usr/include/asm-generic/errno.h:98: note: this is the location of the previous definition
   98 | #define EINPROGRESS     115     /* Operation now in progress */
      | 
p562.cpp:53: warning: "EINTR" redefined
   53 | #define EINTR see_below
      | 
/usr/include/asm-generic/errno-base.h:8: note: this is the location of the previous definition
    8 | #define EINTR            4      /* Interrupted system call */
      | 
p562.cpp:54: warning: "EINVAL" redefined
   54 | #define EINVAL see_below
      | 
/usr/include/asm-generic/errno-base.h:26: note: this is the location of the previous definition
   26 | #define EINVAL          22      /* Invalid argument */
      | 
p562.cpp:55: warning: "EIO" redefined
   55 | #define EIO see_below
      | 
/usr/include/asm-generic/errno-base.h:9: note: this is the location of the previous definition
    9 | #define EIO              5      /* I/O error */
      | 
p562.cpp:56: warning: "EISCONN" redefined
   56 | #define EISCONN see_below
      | 
/usr/include/asm-generic/errno.h:89: note: this is the location of the previous definition
   89 | #define EISCONN         106     /* Transport endpoint is already connected */
      | 
p562.cpp:57: warning: "EISDIR" redefined
   57 | #define EISDIR see_below
      | 
/usr/include/asm-generic/errno-base.h:25: note: this is the location of the previous definition
   25 | #define EISDIR          21      /* Is a directory */
      | 
p562.cpp:58: warning: "ELOOP" redefined
   58 | #define ELOOP see_below
      | 
/usr/include/asm-generic/errno.h:21: note: this is the location of the previous definition
   21 | #define ELOOP           40      /* Too many symbolic links encountered */
      | 
p562.cpp:59: warning: "EMFILE" redefined
   59 | #define EMFILE see_below
      | 
/usr/include/asm-generic/errno-base.h:28: note: this is the location of the previous definition
   28 | #define EMFILE          24      /* Too many open files */
      | 
p562.cpp:60: warning: "EMLINK" redefined
   60 | #define EMLINK see_below
      | 
/usr/include/asm-generic/errno-base.h:35: note: this is the location of the previous definition
   35 | #define EMLINK          31      /* Too many links */
      | 
p562.cpp:61: warning: "EMSGSIZE" redefined
   61 | #define EMSGSIZE see_below
      | 
/usr/include/asm-generic/errno.h:73: note: this is the location of the previous definition
   73 | #define EMSGSIZE        90      /* Message too long */
      | 
p562.cpp:62: warning: "ENAMETOOLONG" redefined
   62 | #define ENAMETOOLONG see_below
      | 
/usr/include/asm-generic/errno.h:8: note: this is the location of the previous definition
    8 | #define ENAMETOOLONG    36      /* File name too long */
      | 
p562.cpp:63: warning: "ENETDOWN" redefined
   63 | #define ENETDOWN see_below
      | 
/usr/include/asm-generic/errno.h:83: note: this is the location of the previous definition
   83 | #define ENETDOWN        100     /* Network is down */
      | 
p562.cpp:64: warning: "ENETRESET" redefined
   64 | #define ENETRESET see_below
      | 
/usr/include/asm-generic/errno.h:85: note: this is the location of the previous definition
   85 | #define ENETRESET       102     /* Network dropped connection because of reset */
      | 
p562.cpp:65: warning: "ENETUNREACH" redefined
   65 | #define ENETUNREACH see_below
      | 
/usr/include/asm-generic/errno.h:84: note: this is the location of the previous definition
   84 | #define ENETUNREACH     101     /* Network is unreachable */
      | 
p562.cpp:66: warning: "ENFILE" redefined
   66 | #define ENFILE see_below
      | 
/usr/include/asm-generic/errno-base.h:27: note: this is the location of the previous definition
   27 | #define ENFILE          23      /* File table overflow */
      | 
p562.cpp:67: warning: "ENOBUFS" redefined
   67 | #define ENOBUFS see_below
      | 
/usr/include/asm-generic/errno.h:88: note: this is the location of the previous definition
   88 | #define ENOBUFS         105     /* No buffer space available */
      | 
p562.cpp:68: warning: "ENODATA" redefined
   68 | #define ENODATA see_below
      | 
/usr/include/asm-generic/errno.h:44: note: this is the location of the previous definition
   44 | #define ENODATA         61      /* No data available */
      | 
p562.cpp:69: warning: "ENODEV" redefined
   69 | #define ENODEV see_below
      | 
/usr/include/asm-generic/errno-base.h:23: note: this is the location of the previous definition
   23 | #define ENODEV          19      /* No such device */
      | 
p562.cpp:70: warning: "ENOENT" redefined
   70 | #define ENOENT see_below
      | 
/usr/include/asm-generic/errno-base.h:6: note: this is the location of the previous definition
    6 | #define ENOENT           2      /* No such file or directory */
      | 
p562.cpp:71: warning: "ENOEXEC" redefined
   71 | #define ENOEXEC see_below
      | 
/usr/include/asm-generic/errno-base.h:12: note: this is the location of the previous definition
   12 | #define ENOEXEC          8      /* Exec format error */
      | 
p562.cpp:72: warning: "ENOLCK" redefined
   72 | #define ENOLCK see_below
      | 
/usr/include/asm-generic/errno.h:9: note: this is the location of the previous definition
    9 | #define ENOLCK          37      /* No record locks available */
      | 
p562.cpp:73: warning: "ENOLINK" redefined
   73 | #define ENOLINK see_below
      | 
/usr/include/asm-generic/errno.h:50: note: this is the location of the previous definition
   50 | #define ENOLINK         67      /* Link has been severed */
      | 
p562.cpp:74: warning: "ENOMEM" redefined
   74 | #define ENOMEM see_below
      | 
/usr/include/asm-generic/errno-base.h:16: note: this is the location of the previous definition
   16 | #define ENOMEM          12      /* Out of memory */
      | 
p562.cpp:75: warning: "ENOMSG" redefined
   75 | #define ENOMSG see_below
      | 
/usr/include/asm-generic/errno.h:23: note: this is the location of the previous definition
   23 | #define ENOMSG          42      /* No message of desired type */
      | 
p562.cpp:76: warning: "ENOPROTOOPT" redefined
   76 | #define ENOPROTOOPT see_below
      | 
/usr/include/asm-generic/errno.h:75: note: this is the location of the previous definition
   75 | #define ENOPROTOOPT     92      /* Protocol not available */
      | 
p562.cpp:77: warning: "ENOSPC" redefined
   77 | #define ENOSPC see_below
      | 
/usr/include/asm-generic/errno-base.h:32: note: this is the location of the previous definition
   32 | #define ENOSPC          28      /* No space left on device */
      | 
p562.cpp:78: warning: "ENOSR" redefined
   78 | #define ENOSR see_below
      | 
/usr/include/asm-generic/errno.h:46: note: this is the location of the previous definition
   46 | #define ENOSR           63      /* Out of streams resources */
      | 
p562.cpp:79: warning: "ENOSTR" redefined
   79 | #define ENOSTR see_below
      | 
/usr/include/asm-generic/errno.h:43: note: this is the location of the previous definition
   43 | #define ENOSTR          60      /* Device not a stream */
      | 
p562.cpp:80: warning: "ENOSYS" redefined
   80 | #define ENOSYS see_below
      | 
/usr/include/asm-generic/errno.h:18: note: this is the location of the previous definition
   18 | #define ENOSYS          38      /* Invalid system call number */
      | 
p562.cpp:81: warning: "ENOTCONN" redefined
   81 | #define ENOTCONN see_below
      | 
/usr/include/asm-generic/errno.h:90: note: this is the location of the previous definition
   90 | #define ENOTCONN        107     /* Transport endpoint is not connected */
      | 
p562.cpp:82: warning: "ENOTDIR" redefined
   82 | #define ENOTDIR see_below
      | 
/usr/include/asm-generic/errno-base.h:24: note: this is the location of the previous definition
   24 | #define ENOTDIR         20      /* Not a directory */
      | 
p562.cpp:83: warning: "ENOTEMPTY" redefined
   83 | #define ENOTEMPTY see_below
      | 
/usr/include/asm-generic/errno.h:20: note: this is the location of the previous definition
   20 | #define ENOTEMPTY       39      /* Directory not empty */
      | 
p562.cpp:84: warning: "ENOTRECOVERABLE" redefined
   84 | #define ENOTRECOVERABLE see_below
      | 
/usr/include/asm-generic/errno.h:117: note: this is the location of the previous definition
  117 | #define ENOTRECOVERABLE 131     /* State not recoverable */
      | 
p562.cpp:85: warning: "ENOTSOCK" redefined
   85 | #define ENOTSOCK see_below
      | 
/usr/include/asm-generic/errno.h:71: note: this is the location of the previous definition
   71 | #define ENOTSOCK        88      /* Socket operation on non-socket */
      | 
p562.cpp:86: warning: "ENOTSUP" redefined
   86 | #define ENOTSUP see_below
      | 
/usr/include/x86_64-linux-gnu/bits/errno.h:30: note: this is the location of the previous definition
   30 | #  define ENOTSUP               EOPNOTSUPP
      | 
p562.cpp:87: warning: "ENOTTY" redefined
   87 | #define ENOTTY see_below
      | 
/usr/include/asm-generic/errno-base.h:29: note: this is the location of the previous definition
   29 | #define ENOTTY          25      /* Not a typewriter */
      | 
p562.cpp:88: warning: "ENXIO" redefined
   88 | #define ENXIO see_below
      | 
/usr/include/asm-generic/errno-base.h:10: note: this is the location of the previous definition
   10 | #define ENXIO            6      /* No such device or address */
      | 
p562.cpp:89: warning: "EOPNOTSUPP" redefined
   89 | #define EOPNOTSUPP see_below
      | 
/usr/include/asm-generic/errno.h:78: note: this is the location of the previous definition
   78 | #define EOPNOTSUPP      95      /* Operation not supported on transport endpoint */
      | 
p562.cpp:90: warning: "EOVERFLOW" redefined
   90 | #define EOVERFLOW see_below
      | 
/usr/include/asm-generic/errno.h:58: note: this is the location of the previous definition
   58 | #define EOVERFLOW       75      /* Value too large for defined data type */
      | 
p562.cpp:91: warning: "EOWNERDEAD" redefined
   91 | #define EOWNERDEAD see_below
      | 
/usr/include/asm-generic/errno.h:116: note: this is the location of the previous definition
  116 | #define EOWNERDEAD      130     /* Owner died */
      | 
p562.cpp:92: warning: "EPERM" redefined
   92 | #define EPERM see_below
      | 
/usr/include/asm-generic/errno-base.h:5: note: this is the location of the previous definition
    5 | #define EPERM            1      /* Operation not permitted */
      | 
p562.cpp:93: warning: "EPIPE" redefined
   93 | #define EPIPE see_below
      | 
/usr/include/asm-generic/errno-base.h:36: note: this is the location of the previous definition
   36 | #define EPIPE           32      /* Broken pipe */
      | 
p562.cpp:94: warning: "EPROTO" redefined
   94 | #define EPROTO see_below
      | 
/usr/include/asm-generic/errno.h:54: note: this is the location of the previous definition
   54 | #define EPROTO          71      /* Protocol error */
      | 
p562.cpp:95: warning: "EPROTONOSUPPORT" redefined
   95 | #define EPROTONOSUPPORT see_below
      | 
/usr/include/asm-generic/errno.h:76: note: this is the location of the previous definition
   76 | #define EPROTONOSUPPORT 93      /* Protocol not supported */
      | 
p562.cpp:96: warning: "EPROTOTYPE" redefined
   96 | #define EPROTOTYPE see_below
      | 
/usr/include/asm-generic/errno.h:74: note: this is the location of the previous definition
   74 | #define EPROTOTYPE      91      /* Protocol wrong type for socket */
      | 
p562.cpp:97: warning: "ERANGE" redefined
   97 | #define ERANGE see_below
      | 
/usr/include/asm-generic/errno-base.h:38: note: this is the location of the previous definition
   38 | #define ERANGE          34      /* Math result not representable */
      | 
p562.cpp:98: warning: "EROFS" redefined
   98 | #define EROFS see_below
      | 
/usr/include/asm-generic/errno-base.h:34: note: this is the location of the previous definition
   34 | #define EROFS           30      /* Read-only file system */
      | 
p562.cpp:99: warning: "ESPIPE" redefined
   99 | #define ESPIPE see_below
      | 
/usr/include/asm-generic/errno-base.h:33: note: this is the location of the previous definition
   33 | #define ESPIPE          29      /* Illegal seek */
      | 
p562.cpp:100: warning: "ESRCH" redefined
  100 | #define ESRCH see_below
      | 
/usr/include/asm-generic/errno-base.h:7: note: this is the location of the previous definition
    7 | #define ESRCH            3      /* No such process */
      | 
p562.cpp:101: warning: "ETIME" redefined
  101 | #define ETIME see_below
      | 
/usr/include/asm-generic/errno.h:45: note: this is the location of the previous definition
   45 | #define ETIME           62      /* Timer expired */
      | 
p562.cpp:102: warning: "ETIMEDOUT" redefined
  102 | #define ETIMEDOUT see_below
      | 
/usr/include/asm-generic/errno.h:93: note: this is the location of the previous definition
   93 | #define ETIMEDOUT       110     /* Connection timed out */
      | 
p562.cpp:103: warning: "ETXTBSY" redefined
  103 | #define ETXTBSY see_below
      | 
/usr/include/asm-generic/errno-base.h:30: note: this is the location of the previous definition
   30 | #define ETXTBSY         26      /* Text file busy */
      | 
p562.cpp:104: warning: "EWOULDBLOCK" redefined
  104 | #define EWOULDBLOCK see_below
      | 
/usr/include/asm-generic/errno.h:22: note: this is the location of the previous definition
   22 | #define EWOULDBLOCK     EAGAIN  /* Operation would block */
      | 
p562.cpp:105: warning: "EXDEV" redefined
  105 | #define EXDEV see_below
      | 
/usr/include/asm-generic/errno-base.h:22: note: this is the location of the previous definition
   22 | #define EXDEV           18      /* Cross-device link */
      | 
19.4.2 Header <cerrno> synopsis [cerrno.syn] C++N4910:2022 (386) p562.c

検討事項(agenda)

コンパイルエラーを取るか、コンパイルエラーの理由を解説する。

Script

clgc.sh
#!/bin/sh
rm $1l
rm $1g
echo "$ clang++ $1.cpp -std=03 -o $1l -I. -Wall" 
clang++ $1.cpp -std=c++03 -o $1l -I. -Wall
if [  -e $1l ]; then
./$1l 
fi
rm $1l
echo "$ clang++ $1.cpp -std=2b -o $1l -I. -Wall"
clang++ $1.cpp -std=c++2b -o $1l -I. -Wall
if [  -e $1l ]; then
./$1l
fi
echo "\r"
echo "$ g++ $1.cpp -std=03 -o $1g -I. -Wall"
g++ $1.cpp -std=c++03 -o $1g -I. -Wall
if [ -e $1g ]; then
./$1g
fi
rm $1g
echo "\r"
echo "$ g++ $1.cpp -std=2b -o $1g -I. -Wall"
g++ $1.cpp -std=c++2b -o $1g -I. -Wall
if [ -e $1g ]; then
./$1g 
fi

参考資料(reference)

cpprefjp - C++日本語リファレンス

コンパイラの実装状況

typedef は C++11 ではオワコン

C99からC++14を駆け抜けるC++講座

@kazuo_reve 私が効果を確認した「小川メソッド」

自己参照(self reference)

DoCAP(ドゥーキャップ)って何ですか?

小川メソッド 覚え(書きかけ)

コピペコンパイルエラーあるある

C++ Error Message Collection(1)does not name a type, 11 articles

dockerにclang

docker gnu(gcc/g++) and llvm(clang/clang++)

コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)

Compare the contents of C++N4910:2022, C++N4741:2018 and C++N4606:2015

C++ sample list

clang++, g++コンパイルエラー方針の違いの例

astyle 使ってみた

C++N4606 Working Draft 2016, ISO/IEC 14882, C++ standardのコード断片をコンパイルするためにしていること
https://qiita.com/kaizen_nagoya/items/a8d7ee2f2e29e76c19c1

コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)
https://qiita.com/kaizen_nagoya/items/74220c0577a512c2d7da

Clang/Clang++(LLVM) gcc/g++(GNU) コンパイラ警告等比較
https://qiita.com/kaizen_nagoya/items/9a82b958cc3aeef0403f

C++2003とC++2017でコンパイルエラーになるならない事例集
https://qiita.com/kaizen_nagoya/items/a13ea3823441c430edff

Qiitaに投稿するCのStyle例(暫定)
https://qiita.com/kaizen_nagoya/items/946df1528a6a1ef2bc0d

cpprefjpのdecltypeをコンパイル試験
https://qiita.com/kaizen_nagoya/items/090909af702f0d5d8a67

MISRA C++ 5-0-16
https://qiita.com/kaizen_nagoya/items/7df2d4e05db724752a74

C++ Templates Part1 BASICS Chapter 3. Class Templates 3.2 Use of Class Template Stack stack1test.cpp
https://qiita.com/kaizen_nagoya/items/cd5fc49106fad5a4e9ed

ISO/IEC TS 17961:2013 C Secure Coding Rules(1) All list(to be confirmed)
https://qiita.com/kaizen_nagoya/items/54e056195c4f11b850a1

C言語(C++)に対する誤解、曲解、無理解、爽快。
https://qiita.com/kaizen_nagoya/items/3f3992c9722c1cee2e3a

C Puzzle Bookの有り難み5つ、C言語規格及びCコンパイラの特性を認識
https://qiita.com/kaizen_nagoya/items/d89a48c1536a02ecdec9

'wchar.h' file not found で困った clang++ macOS
https://qiita.com/kaizen_nagoya/items/de15cd46d657517fac11

Open POSIX Test Suiteの使い方を調べはじめました
https://qiita.com/kaizen_nagoya/items/644d5e407f5faf96e6dc

MISRA-C 2012 Referenceに掲載している文献の入手可能性を確認
https://qiita.com/kaizen_nagoya/items/96dc8b125e462d5575bb

どうやって MISRA Example Suiteをコンパイルするか
https://qiita.com/kaizen_nagoya/items/fbdbff5ff696e2ca7f00

MISRA C まとめ #include
https://qiita.com/kaizen_nagoya/items/f1a79a7cbd281607c7c9

「C++完全理解ガイド」の同意できること上位10
https://qiita.com/kaizen_nagoya/items/aa5744e0c4a8618c7671

<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>

文書履歴(document history)

ver. 0.01 初稿  20220715

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?