Skip to content

Commit 701ae82

Browse files
fix: update DocLink src to DocLink dest (#81)
Also update `migrate/PROMPT.md` to mention this.
1 parent 432f9e7 commit 701ae82

File tree

4 files changed

+43
-43
lines changed

4 files changed

+43
-43
lines changed

migrate/PROMPT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ You are a professional C++ documentation writer. You are now migrating cpprefere
44
3. For links, take the URL part, remove `/w/` and the latter part `.html`, and then wrap it with `DocLink`. For example:
55
If the current path is: `/w/cpp/language/basics.html`
66
Link: `<a href="declarations.html" title="cpp/language/declarations">declarations</a>`
7-
You should, based on the current link, change it to: `<DocLink src="/cpp/language/declarations">declarations</DocLink>`
7+
You should, based on the current link, change it to: `<DocLink dest="/cpp/language/declarations">declarations</DocLink>`
88
4. Currently available components:
99
```mdx
1010
{{LLM_DOCS}}

src/content/docs/cpp/language/exceptions.mdx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ import { FeatureTestMacro, FeatureTestMacroValue } from "@components/feature-tes
1313

1414
Exception handling provides a way of transferring control and information from some point in the execution of a program to a handler associated with a point previously passed by the execution (in other words, exception handling transfers control up the call stack).
1515

16-
Evaluating a <DocLink src="cpp/language/throw.html#throw_expressions">`throw` expression</DocLink> will throw an exception. Exceptions can also be thrown in <DocLink src="cpp/language/throw.html#throw_expressions">other contexts</DocLink>.
16+
Evaluating a <DocLink dest="cpp/language/throw.html#throw_expressions">`throw` expression</DocLink> will throw an exception. Exceptions can also be thrown in <DocLink dest="cpp/language/throw.html#throw_expressions">other contexts</DocLink>.
1717

18-
In order for an exception to be caught, the `throw` expression has to be inside a <DocLink src="cpp/language/try">`try` block</DocLink>, and the `try` block has to contain a <DocLink src="cpp/language/catch">handler</DocLink> that matches the type of the exception object.
18+
In order for an exception to be caught, the `throw` expression has to be inside a <DocLink dest="cpp/language/try">`try` block</DocLink>, and the `try` block has to contain a <DocLink dest="cpp/language/catch">handler</DocLink> that matches the type of the exception object.
1919

2020
When declaring a function, the following specification(s) may be provided to limit the types of the exceptions a function may throw:
2121

22-
- <Revision since="C++17"><DocLink src="cpp/language/cpp/language/except_spec">dynamic exception specifications</DocLink></Revision>
23-
- <Revision since="C++11"><DocLink src="cpp/language/cpp/language/noexcept_spec">noexcept specifications</DocLink></Revision>
22+
- <Revision since="C++17"><DocLink dest="cpp/language/cpp/language/except_spec">dynamic exception specifications</DocLink></Revision>
23+
- <Revision since="C++11"><DocLink dest="cpp/language/cpp/language/noexcept_spec">noexcept specifications</DocLink></Revision>
2424

25-
Errors that arise during exception handling are handled by <DocLink src="cpp/error/terminate">`std::terminate`</DocLink> and <Revision since="C++17"><DocLink src="cpp/error/unexpected">`std::unexpected`</DocLink></Revision>.
25+
Errors that arise during exception handling are handled by <DocLink dest="cpp/error/terminate">`std::terminate`</DocLink> and <Revision since="C++17"><DocLink dest="cpp/error/unexpected">`std::unexpected`</DocLink></Revision>.
2626

2727
## Usage
2828

29-
While `throw` expression can be used to transfer control to an arbitrary block of code up the execution stack, for arbitrary reasons (similar to <DocLink src="cpp/utility/program/longjmp">`std::longjmp`</DocLink>), its intended usage is error handling.
29+
While `throw` expression can be used to transfer control to an arbitrary block of code up the execution stack, for arbitrary reasons (similar to <DocLink dest="cpp/utility/program/longjmp">`std::longjmp`</DocLink>), its intended usage is error handling.
3030

3131
### Error handling
3232

@@ -36,24 +36,24 @@ Throwing an exception is used to signal errors from functions, where "errors" ar
3636
2. Failures to meet the preconditions of another function that must be called.
3737
3. (for non-private member functions) Failures to (re)establish a class invariant.
3838

39-
In particular, this implies that the failures of constructors (see also <DocLink src="cpp/language/raii">RAII</DocLink>) and most operators should be reported by throwing exceptions.
39+
In particular, this implies that the failures of constructors (see also <DocLink dest="cpp/language/raii">RAII</DocLink>) and most operators should be reported by throwing exceptions.
4040

41-
In addition, so-called *wide contract* functions use exceptions to indicate unacceptable inputs, for example, <DocLink src="cpp/string/basic_string/at">`std::basic_string::at`</DocLink> has no preconditions, but throws an exception to indicate index out of range.
41+
In addition, so-called *wide contract* functions use exceptions to indicate unacceptable inputs, for example, <DocLink dest="cpp/string/basic_string/at">`std::basic_string::at`</DocLink> has no preconditions, but throws an exception to indicate index out of range.
4242

4343
### Exception safety
4444

4545
After the error condition is reported by a function, additional guarantees may be provided with regards to the state of the program. The following four levels of exception guarantee are generally recognized[^4] [^5] [^6], which are strict supersets of each other:
4646

47-
1. *Nothrow (or nofail) exception guarantee* — the function never throws exceptions. Nothrow (errors are reported by other means or concealed) is expected of <DocLink src="cpp/language/destructor">destructors</DocLink> and other functions that may be called during stack unwinding. <Revision since="C++11">The <DocLink src="cpp/language/destructor">destructors</DocLink> are <DocLink src="cpp/language/noexcept">`noexcept`</DocLink> by default.</Revision> Nofail (the function always succeeds) is expected of swaps, <DocLink src="cpp/language/move_constructor">move constructors</DocLink>, and other functions used by those that provide strong exception guarantee.
48-
2. *Strong exception guarantee* — If the function throws an exception, the state of the program is rolled back to the state just before the function call (for example, <DocLink src="cpp/container/vector/push_back">`std::vector::push_back`</DocLink>).
47+
1. *Nothrow (or nofail) exception guarantee* — the function never throws exceptions. Nothrow (errors are reported by other means or concealed) is expected of <DocLink dest="cpp/language/destructor">destructors</DocLink> and other functions that may be called during stack unwinding. <Revision since="C++11">The <DocLink dest="cpp/language/destructor">destructors</DocLink> are <DocLink dest="cpp/language/noexcept">`noexcept`</DocLink> by default.</Revision> Nofail (the function always succeeds) is expected of swaps, <DocLink dest="cpp/language/move_constructor">move constructors</DocLink>, and other functions used by those that provide strong exception guarantee.
48+
2. *Strong exception guarantee* — If the function throws an exception, the state of the program is rolled back to the state just before the function call (for example, <DocLink dest="cpp/container/vector/push_back">`std::vector::push_back`</DocLink>).
4949
3. *Basic exception guarantee* — If the function throws an exception, the program is in a valid state. No resources are leaked, and all objects' invariants are intact.
5050
4. *No exception guarantee* — If the function throws an exception, the program may not be in a valid state: resource leaks, memory corruption, or other invariant-destroying errors may have occurred.
5151

52-
Generic components may, in addition, offer *exception-neutral guarantee*: if an exception is thrown from a template parameter (e.g. from the `Compare` function object of <DocLink src="cpp/algorithm/sort">`std::sort`</DocLink> or from the constructor of `T` in <DocLink src="cpp/memory/shared_ptr/make_shared">`std::make_shared`</DocLink>), it is propagated, unchanged, to the caller.
52+
Generic components may, in addition, offer *exception-neutral guarantee*: if an exception is thrown from a template parameter (e.g. from the `Compare` function object of <DocLink dest="cpp/algorithm/sort">`std::sort`</DocLink> or from the constructor of `T` in <DocLink dest="cpp/memory/shared_ptr/make_shared">`std::make_shared`</DocLink>), it is propagated, unchanged, to the caller.
5353

5454
## Exception objects
5555

56-
While objects of any complete type and cv pointers to `void` may be thrown as exception objects, all standard library functions throw unnamed objects by value, and the types of those objects are derived (directly or indirectly) from <DocLink src="cpp/error/exception">`std::exception`</DocLink>. User-defined exceptions usually follow this pattern.[^7] [^8] [^9]
56+
While objects of any complete type and cv pointers to `void` may be thrown as exception objects, all standard library functions throw unnamed objects by value, and the types of those objects are derived (directly or indirectly) from <DocLink dest="cpp/error/exception">`std::exception`</DocLink>. User-defined exceptions usually follow this pattern.[^7] [^8] [^9]
5757

5858
To avoid unnecessary copying of the exception object and object slicing, the best practice for handlers is to catch by reference.[^10] [^11] [^12] [^13]
5959

src/content/docs/cpp/language/preprocessor.mdx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Desc, DescList, DocLink } from '@components/index';
88
import { Revision, RevisionBlock } from "@components/revision";
99
import { DR, DRList } from "@components/defect-report";
1010

11-
The preprocessor is executed at <DocLink src="/cpp/language/translation_phases" anchor="Phase_4">translation phase 4</DocLink>, before the compilation. The result of preprocessing is a single file which is then passed to the actual compiler.
11+
The preprocessor is executed at <DocLink dest="/cpp/language/translation_phases" anchor="Phase_4">translation phase 4</DocLink>, before the compilation. The result of preprocessing is a single file which is then passed to the actual compiler.
1212

1313
## Directives
1414

@@ -17,11 +17,11 @@ The preprocessing directives control the behavior of the preprocessor. Each dire
1717
* the `#` character.
1818
* a sequence of:
1919
* a standard-defined directive name (listed [below](#Capabilities)) followed by the corresponding arguments, or
20-
* one or more <DocLink src="/cpp/language/translation_phases" anchor="Phase_3">preprocessing tokens</DocLink> where the beginning token is not a standard-defined directive name, in this case the directive is conditionally-supported with implementation-defined semantics <Revision until="C++23">(e.g. a common extension is the directive `#warning` which emits a user-defined message during compilation)</Revision>, or
20+
* one or more <DocLink dest="/cpp/language/translation_phases" anchor="Phase_3">preprocessing tokens</DocLink> where the beginning token is not a standard-defined directive name, in this case the directive is conditionally-supported with implementation-defined semantics <Revision until="C++23">(e.g. a common extension is the directive `#warning` which emits a user-defined message during compilation)</Revision>, or
2121
* nothing, in this case the directive has no effect.
2222
* a line break.
2323

24-
<Revision since="C++20">The <DocLink src="/cpp/language/modules">module and import directives</DocLink> are also preprocessing directives.</Revision>
24+
<Revision since="C++20">The <DocLink dest="/cpp/language/modules">module and import directives</DocLink> are also preprocessing directives.</Revision>
2525

2626
Preprocessing directives must not come from macro expansion.
2727

@@ -34,15 +34,15 @@ EMPTY # include <file.h> // not a preprocessing directive
3434

3535
The preprocessor has the source file translation capabilities:
3636

37-
* **<DocLink src="/cpp/preprocessor/conditional">conditionally</DocLink>** compile parts of source file (controlled by directive `#if`, `#ifdef`, `#ifndef`, `#else`, <Revision since="C++23">`#elif`, `#elifdef`, `#elifndef`</Revision>, and `#endif`).
38-
* **<DocLink src="/cpp/preprocessor/replace">replace</DocLink>** text macros while possibly concatenating or quoting identifiers (controlled by directives `#define` and `#undef`, and operators `#` and `##`).
39-
* **<DocLink src="/cpp/preprocessor/include">include</DocLink>** other files (controlled by directive `#include` <Revision since="C++23">and checked with `__has_include` </Revision>).
40-
* cause an **<DocLink src="/cpp/preprocessor/error">error</DocLink>** <Revision since="C++17">or **<DocLink src="/cpp/preprocessor/error">warning</DocLink>** </Revision> (controlled by directive `#error` <Revision since="C++23">or `#warning` respectively</Revision>).
37+
* **<DocLink dest="/cpp/preprocessor/conditional">conditionally</DocLink>** compile parts of source file (controlled by directive `#if`, `#ifdef`, `#ifndef`, `#else`, <Revision since="C++23">`#elif`, `#elifdef`, `#elifndef`</Revision>, and `#endif`).
38+
* **<DocLink dest="/cpp/preprocessor/replace">replace</DocLink>** text macros while possibly concatenating or quoting identifiers (controlled by directives `#define` and `#undef`, and operators `#` and `##`).
39+
* **<DocLink dest="/cpp/preprocessor/include">include</DocLink>** other files (controlled by directive `#include` <Revision since="C++23">and checked with `__has_include` </Revision>).
40+
* cause an **<DocLink dest="/cpp/preprocessor/error">error</DocLink>** <Revision since="C++17">or **<DocLink dest="/cpp/preprocessor/error">warning</DocLink>** </Revision> (controlled by directive `#error` <Revision since="C++23">or `#warning` respectively</Revision>).
4141

4242
The following aspects of the preprocessor can be controlled:
4343

44-
* **<DocLink src="/cpp/preprocessor/impl">implementation-defined</DocLink>** behavior (controlled by directive `#pragma` <Revision since="C++11">and operator `_Pragma` </Revision>). In addition, some compilers support (to varying degrees) the operator `__pragma` as an extension.
45-
* **<DocLink src="/cpp/preprocessor/line">file name and line information</DocLink>** available to the preprocessor (controlled by directive `#line`).
44+
* **<DocLink dest="/cpp/preprocessor/impl">implementation-defined</DocLink>** behavior (controlled by directive `#pragma` <Revision since="C++11">and operator `_Pragma` </Revision>). In addition, some compilers support (to varying degrees) the operator `__pragma` as an extension.
45+
* **<DocLink dest="/cpp/preprocessor/line">file name and line information</DocLink>** available to the preprocessor (controlled by directive `#line`).
4646

4747
## Defect reports
4848

@@ -63,12 +63,12 @@ The following behavior-changing defect reports were applied retroactively to pre
6363

6464
<DescList>
6565
<Desc>
66-
<DocLink slot="item" src="/cpp/preprocessor/replace" anchor="Predefined_macros">C++ documentation</DocLink> for <span>Predefined Macro Symbols</span>
66+
<DocLink slot="item" dest="/cpp/preprocessor/replace" anchor="Predefined_macros">C++ documentation</DocLink> for <span>Predefined Macro Symbols</span>
6767
</Desc>
6868
<Desc>
69-
<DocLink slot="item" src="/cpp/symbol_index/macro">C++ documentation</DocLink> for <span>Macro Symbol Index</span>
69+
<DocLink slot="item" dest="/cpp/symbol_index/macro">C++ documentation</DocLink> for <span>Macro Symbol Index</span>
7070
</Desc>
7171
<Desc>
72-
<DocLink slot="item" src="/c/preprocessor">C documentation</DocLink> for <span>preprocessor</span>
72+
<DocLink slot="item" dest="/c/preprocessor">C documentation</DocLink> for <span>preprocessor</span>
7373
</Desc>
7474
</DescList>

0 commit comments

Comments
 (0)